Skip to content

Ensuring the burst worker shuts down if there are no jobs in the queue #501

@jamesleeht

Description

@jamesleeht

If the worker has burst mode enabled, it seems like it does not shut down immediately even if there are 0 jobs in the queue to start with.

Is there a way to enable this? I tried playing around with max_burst_jobs but it doesn't seem to change this behavior.

Potentially, I think it's possible to add something like this to the main function:

        if self.burst:
            queued_jobs = await self.pool.zcard(self.queue_name)
            if queued_jobs == 0:
                logger.info('No jobs in queue, worker terminating in burst mode.')
                return

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions