-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #640 #644
Fix #640 #644
Conversation
@ricardopereira This is expected. You can't call I'll comment on the issue what I think the problem is. |
(3e1bd48) Another try to reproduce the issue but no success. |
@tcard I think we just need to change the |
@ricardopereira No, that's for dispatching to the internal queue when the user is in the user (main) queue. This is the other way around, from the internal queue we need to dispatch to the user queue. And this needs to happen for internal event emitters too, at least those that potentially hold references to user objects. |
@tcard But we are already doing that by encapsulating each user callback with our implementation which dispatches the callback to the user queue:
|
@ricardopereira Right, and that's perfect, but what I didn't anticipate is that there's another way of executing user code from our internal queue: by causing some of their object's reference counts to drop to zero, hence automatically calling their When |
Spec/RealtimeClient.swift
Outdated
@@ -1355,7 +1355,7 @@ class RealtimeClient: QuickSpec { | |||
} | |||
|
|||
// Possible issue of https://github.com/ably/ably-ios/issues/640 | |||
fit("should dispatch in user queue") { | |||
xit("should dispatch in user queue") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be fixed.
Spec/RealtimeClient.swift
Outdated
@@ -1328,6 +1328,56 @@ class RealtimeClient: QuickSpec { | |||
expect(result).to(equal(expectedOrder)) | |||
} | |||
|
|||
// Possible issue of https://github.com/ably/ably-ios/issues/640 | |||
xit("should unlock queue when the timer ends") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this one, the other reproduces the issue more clearly from a user persoective without meddling with the internal emitter.
Spec/RealtimeClient.swift
Outdated
} | ||
|
||
let foo = Foo() | ||
foo.close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, does this really reproduce the issue? I think if you call close
here, then it will remove the listener you add at init
but since you still have a reference to the created object its deinit
won't be called, and when you drop the reference just after, since you already removed the listener, its deinit
's unsubscribe
will just do nothing.
I think deinit
should just call unsubscribe
directly; we don't need close
.
Please confirm this reproduces the issue by commenting out the dispatch_async
in removeListener
and making sure this test then fails, and stops failing if you put it back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, does this really reproduce the issue?
I think so but it always pass. I'll change the code with your points. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It always passes d0b8aeb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we ask the client to test using the branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ricardopereira Yes, but we also need to have a test that actually reproduces the problem. Maybe instead of self
we can reference a different object, then make sure we drop the other reference to it before dropping the reference to foo
?
d0b8aeb
to
c3fa54f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :)
4ac7c16
to
c5616b5
Compare
Squashed. |
#640