Function transaction_cleanup_handler

Source
pub async fn transaction_cleanup_handler(
    job: TransactionCleanupCronReminder,
    data: Data<ThinData<DefaultAppState>>,
    attempt: Attempt,
) -> Result<(), Error>
Expand description

Handles periodic transaction cleanup jobs from the queue.

This function processes expired transactions by:

  1. Fetching all relayers from the system
  2. For each relayer, finding transactions with final statuses
  3. Checking if their delete_at timestamp has passed
  4. Validating transactions are in final states before deletion
  5. Deleting transactions that have expired (in parallel)

§Arguments

  • job - The cron reminder job triggering the cleanup
  • data - Application state containing repositories
  • attempt - Current attempt number for retry logic

§Returns

  • Result<(), Error> - Success or failure of cleanup processing