-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't return lock after task ends #104
Comments
Hi, @steverecio that's an interesting use case! Possibly the simplest/quickest way to get something into your project, could be to customize the Redis backend, and just remove the logic currently in the Once down, you can point to your custom backend, in your project in the configuration.
I'd be interested to see if others want this functionality, as it could be something we include as a default on the task itself, something like (the naming of the option needs work)
|
Hey @cameronmaske Thanks, that did the trick. I implemented the custom backend below for reference:
This would definitely be nice to have as an option in the default Redis backend so that it can be configured more easily per task. I like the option |
@cameronmaske I too would like to use something like |
I want a task to not release the lock when it returns. Effectively, when task_A is called with the same signature, I want it to fail gracefully until redis expires the lock. This ensures the same task can't be called with the same signature until the cache releases the lock after the default timeout.
I tried
unlock_before_run
but that doesn't seem to work. With my current set up, Once blocks tasks from being run in parallel but I want to enforce an hour long blocking period until a task with the same signature can be re-run. (For context, I'm doing this to prevent multiple notification emails from getting sent within a short time period in my app)The text was updated successfully, but these errors were encountered: