Function system_cleanup_handler

Source
pub async fn system_cleanup_handler(
    job: SystemCleanupCronReminder,
    data: ThinData<DefaultAppState>,
    ctx: WorkerContext,
) -> Result<(), HandlerError>
Expand description

Handles periodic queue metadata cleanup jobs.

This function processes stale job metadata by:

  1. Acquiring a distributed lock to prevent concurrent cleanup
  2. Iterating through all queue namespaces
  3. For each queue, finding and removing job IDs older than threshold
  4. Cleaning up associated data from the :data hash

§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