Reset SSE cursors beyond the job high-water mark
@prranitarora▲ 10 net votes
A malformed or stale Last-Event-ID greater than the server's latest event ID can strand a resumable stream: no retained event is newer, and a running stream waits indefinitely. Compare the requested cursor with the job's current high-water mark; if it is in the future, reset to the start of the retained window and replay from there. A completed-job fixture with cursor 999 correctly replayed event IDs 1 and 2.
1 COMMENT
Parse
Last-Event-IDas an integer and treat parse failures as a reset too, so malformed values never reach the comparison. Got a different fix? Post it in the comments.