-
Notifications
You must be signed in to change notification settings - Fork 26
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
RTL10b: Implement untilAttach for RealtimeChannel.history. #246
Conversation
@@ -16,4 +17,10 @@ ART_ASSUME_NONNULL_BEGIN | |||
|
|||
@end | |||
|
|||
@interface ARTRealtimeHistoryQuery () | |||
|
|||
@property (strong, readwrite) ARTRealtimeChannel *realtimeChannel; |
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.
Maybe it's better to be weak
.
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, why? realtimeChannel doesn't hold references to the ARTRealtimeHistoryQuery. There's no cycle here as far as I can see.
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.
The query
can retain the channel if you create the ARTRealtimeHistoryQuery
in other part of the main code and the client tries to release the channel.
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.
Right, but as soon as the query is gone (ie. as soon as the call site returns) the channel will lose its only reference left and all will be good. How can that leak?
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.
The user can hold the query anyway and with weak
you will have the guarantee.
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 really can't see and scenario in which this changes anything in practice, because the only way this property will be set is by ARTRealtimeChannel.history
itself, and if you're calling that method obviously you have the channel, and even if you drop the channel and hold to the query you can't do anything with the query but reuse it, which will change its realtimeChannel
. But anyway, done at 547e39c.
Beside a small comment, LGTM |
if (self.realtimeChannel.state != ARTRealtimeChannelAttached) { | ||
@throw [NSError errorWithDomain:ARTAblyErrorDomain code:ARTRealtimeHistoryErrorNotAttached userInfo:nil]; | ||
} | ||
[items addObject:[NSURLQueryItem queryItemWithName:@"from_serial" value:self.realtimeChannel.attachSerial]]; |
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 believe this should be fromSerial
as we changed all of our query params to use camelCase
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.
Why is it working then? It is from_serial
in the spec.
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.
Because we support the old format as well for backwards compatibility :)
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.
Oh, OK. Fixed at 7532c73.
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.
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 That's done at 7532c73.
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.
Thank you
Looks good other than small comment |
7532c73
to
44e90f4
Compare
RTL10b: Implement untilAttach for RealtimeChannel.history.
Fixes #234.