Skip to content

Add option to skip herd avoidance check, but still trigger avoidance for other tasks #57

@thenewguy

Description

@thenewguy

I have a situation where I would like to use thundering herd avoidance conditionally.

It would be easy to support this with a conditional check at https://github.com/PolicyStat/jobtastic/blob/master/jobtastic/task.py#L242 and pop the key out of the options that get passed to the superclass.

Something like the following should do the trick:

        # Check for an in-progress equivalent task to avoid duplicating work
        if not options.pop('disable_thundering_herd_avoidance', False):
            task_id = cache.get('herd:%s' % cache_key)
            if task_id:
                logging.info('Found existing in-progress task: %s', task_id)
                return self.AsyncResult(task_id)

This would work nicely with #56

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