DOMjudge / domjudge

DOMjudge programming contest jury system
https://www.domjudge.org
GNU General Public License v2.0
701 stars 249 forks source link

Fix missing events in the feed due to out of order commits #2498

Closed meisterT closed 2 months ago

meisterT commented 2 months ago

Events may become available to read by the event-feed API controller out of event_id order because they are (sometimes) created inside a transaction. The old code was only looking for events with ID larger than the last one emitted, which could lead to skipping events. This happened at the WFs in Luxor especially with judging events for a compiler error, as inside a transaction two events are logged and then the scoreboard is recalculated, leaving plenty of time for another event to get logged in the mean time.

Fix this by querying for all events and making sure that we're not missing any sequential event_ids. If we do wait and retry for one second, and only then skip these. This means that event filtering must now be done in code rather than in the SQL query.

sentry-io[bot] commented 2 months ago

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: webapp/src/Controller/API/ContestController.php

Function Unhandled Issue
App\Controller\API\ContestController::getEventFeedAction Symfony\Component\HttpKernel\Exception\BadRequestHttpException: Invalid parameter "since_token" requested. /src/Controller/API/ContestController.php i...
Event Count: 4

Did you find this useful? React with a 👍 or 👎