Skip to content

Make reenqueue_orphaned_after optional for long running tasks #530

@jpoisso

Description

@jpoisso

I'm working on a use-case that is somewhat atypical, at least when compared to the examples within the project.
The application itself uses Actix Web to expose admin endpoints to manage a list of devices, and Apallis automatically spins up workers that continously monitor them. (1-1 mapping, each device has a worker on an infinite loop)

While prototyping, I noticed duplicate jobs were launched after a certain amount of time, leading to conflicts in operations. This was caused by the reenqueue_orphaned_after value since long running operations are considered orphaned. The default value is 5 minutes, which made it very difficult to identity :)

I settled on simply providing a very large duration (>100 years) to avoid having duplicate tasks, but I'm wondering if there's apetite to officially support this type of workflow?

    let postgres_config = Config::new("apalis::devices")
        .set_reenqueue_orphaned_after(Duration::from_secs(u32::MAX as u64));

We could set an Option<Duration> value instead, which would skip the check entirely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions