Skip to content

Commit

Permalink
Fix event feed last event ID lookup.
Browse files Browse the repository at this point in the history
This has been added in DOMjudge@ef8c832

The first `eventid` will be 1. If the event feed reading client does not
pass in a `since_token` or `since_id`, we set `since_id` to `-1` to
signal start reading from the beginning. In that case there is no
previous event that can be expected to exist.
  • Loading branch information
meisterT committed Oct 6, 2024
1 parent b3db6ab commit a52f7cc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions webapp/src/Controller/API/ContestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,8 @@ public function getEventFeedAction(
$response->headers->set('Content-Type', 'application/x-ndjson');
$response->setCallback(function () use ($format, $cid, $contest, $request, $since_id, $types, $strict, $stream, $metadataFactory, $kernel) {
$lastUpdate = 0;
$lastIdSent = max(0, $since_id); // Don't try to look for event_id=0
$lastIdExists = $since_id === -1;
$lastIdSent = max(0, $since_id);
$lastIdExists = $since_id !== -1; // Don't try to look for event_id=0
$typeFilter = false;
if ($types) {
$typeFilter = explode(',', $types);
Expand Down

0 comments on commit a52f7cc

Please sign in to comment.