You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When requesting for example the newest comments in a subreddit, adding the 'before' option shows all comments. The expected result would be all comments newer than the comment specified (fullname of the comment passed via 'before:').
Example:
comments=session.subreddit('scotch').comments(before: 't1_dt288wj')# substitute with more recent fullnameenum=comments.stream100.timesdoputsenum.next.nameend# observe that at some point we get the comment with the given fullname and# afterwards all the older comments ordered by descending time.# likewise for enum = comments.each
Version: 0.9.0.pre.3
Analysis
My guess is that it comes from #fetch_prev_listing in PaginatedListing. If the returned listing is empty, it will set @before to nil. Is this intended behaviour? I would expect one of three things:
Raise a StopIteration
Return nil
Block and poll frequently until a new listing item (comment in this case) is available.
Raising StopIteration would have my preference, but that might make it harder to restart the listing. Blocking would be difficult if you want to combine different streams. For example, if you would want to iterate over both comments and submissions at the same time. (addition:) Instead of blocking, we could also use the concurrent-ruby gem to do the polling on a separate thread. Anytime when new data is available we can send a message to the obserber/block.
If this is intended behaviour, how would I approach this in an application where I only want to receive newer items?
The text was updated successfully, but these errors were encountered:
When requesting for example the newest comments in a subreddit, adding the 'before' option shows all comments. The expected result would be all comments newer than the comment specified (fullname of the comment passed via 'before:').
Example:
Version: 0.9.0.pre.3
Analysis
My guess is that it comes from
#fetch_prev_listing
in PaginatedListing. If the returned listing is empty, it will set@before
to nil. Is this intended behaviour? I would expect one of three things:Raising StopIteration would have my preference, but that might make it harder to restart the listing. Blocking would be difficult if you want to combine different streams. For example, if you would want to iterate over both comments and submissions at the same time. (addition:) Instead of blocking, we could also use the concurrent-ruby gem to do the polling on a separate thread. Anytime when new data is available we can send a message to the obserber/block.
If this is intended behaviour, how would I approach this in an application where I only want to receive newer items?
The text was updated successfully, but these errors were encountered: