-
Notifications
You must be signed in to change notification settings - Fork 2
Description
In work
of subscriber in relayer_base, self.transaction_poller.poll_account
updates the subscriber cursor (latest transaction seen / block scanned etc), so that in the next poll, we don't make the same call. However, queue.publish
is called later in work
, and if that fails there is no retry logic or undoing of the cursor update.
This results in a potential transaction miss, since the transaction will never be written in the queue but the subscriber will move forward. A similar issue exists if anything else crashes, or if the service is stopped in that frame between the update of the cursor and the enqueueing.
The same issue exists in the distributor, as store_last_task_id()
is called before publish
in queue.
Proposed solution:
Update the cursor only after successful enqueueing has happened (from that point onwards we can do retries and we have some log of the subscriber entry for anything that might go wrong, so it's safe to move the cursor forward).
Note: publish
in queue.rs does not return a result, it simply logs an error message, so in case of a queue failure, the subscriber will not be notified and will proceed normally as is.