Closed Iftimie closed 2 years ago
Thanks for this!
It looks like the two commits aren't quite related. The one that fixes the infinite loop seems legitimate, and I'm willing to merge it. However, I'm skeptical about the one that changes the storage behavior. Can you remove the latter (perhaps put it in a separate PR) so that I can merge this PR to only fix the infinite loop?
Hi! Sorry for the second commit. That was a mistake.
Summary:
request.channel_last_ids[channel]
with itExplanation: When the frontend sends lastEventId like
ReconnectingEventSource('/events/?channel=testchannel', {lastEventId: 'testchannel:0'})
or like thisReconnectingEventSource('/events/?channel=testchannel&lastEventId=testchannel:0')
the backend can get in an infinite loop.
resp.channel_more.add(channel)
is executedif len(event_response.channel_more) > 0
is true and the loop continuesawait self.get_events(event_request)
is executed with the same requests which has the same initial last_idThus, overwriting the last_id in the same request object solves the problem