Function transaction_cleanup_handler

Source
pub async fn transaction_cleanup_handler(
    job: TransactionCleanupCronReminder,
    data: ThinData<DefaultAppState>,
    ctx: WorkerContext,
) -> Result<(), HandlerError>
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
  • ctx - Worker context with attempt number and task ID

§Returns

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