Oban cron worker for removing expired upload sessions and their staged objects.
Delegates entirely to Rindle's internal upload-maintenance service — no cleanup logic lives here. Adopters can schedule this worker from their Oban cron config without requiring Rindle to supervise Oban.
Cron Configuration Example
In your Oban configuration:
config :my_app, Oban,
queues: [rindle_maintenance: 1],
plugins: [
{Oban.Plugins.Cron,
crontab: [
{"0 2 * * *", Rindle.Workers.CleanupOrphans,
args: %{"dry_run" => false}},
{"0 1 * * *", Rindle.Workers.AbortIncompleteUploads}
]}
]Job Arguments
"dry_run"(boolean, defaulttrue) — whentrue, reports planned actions without executing any deletes. Safe for inspection cron runs."storage"(string, optional) — fully-qualified storage adapter module name. When omitted, falls back to:default_storagefrom the:rindleapplication config.
Return Contract
:ok— cleanup completed (including dry runs).{:error, reason}— cleanup service returned an error; Oban will retry according to the worker'smax_attemptspolicy so failures are tagged and observable in the job queue.
Observability
Failures appear as Oban job errors with attempt and max_attempts metadata.
The underlying UploadMaintenance service also emits Logger.warning events
tagged with rindle.upload_maintenance.* for storage-level errors.
Worker-level events:
Logger.info("rindle.workers.cleanup_orphans.completed", ...)— emitted after a successful cleanup withsessions_found,sessions_deleted,objects_deleted,storage_skipped,storage_errors,dry_run.Logger.error("rindle.workers.cleanup_orphans.failed", ...)— emitted when the maintenance service returns{:error, reason}AND when the storage adapter cannot be resolved (stage: :resolve_storage_adapter). Operators should alert on this event for both pipelines.Logger.error("rindle.workers.cleanup_orphans.storage_load_failed", ...)and…storage_not_found— more specific events emitted by the helper before the worker-level…failedevent fires.