Skip to content

Cursor in subscriber and distributor is updated before publishing to queue #65

@Deiadara

Description

@Deiadara

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions