question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option to release lock on task acceptance

See original GitHub issue

My app watches for data changes, and then schedules a singleton task for cache regeneration. The singleton is very helpful, because i’m not queueing the same task multiple times if data changes in succession; any additional data changes will be reflected whenever the task is finally run.

However, i’m dealing with a race condition: if a task has been accepted, and data has changed after the task has accessed the database but before the task is completed (which is when the lock is released), the latest changes will not be reflected in the result- and any attempts to re-schedule the task during that time will fail because the lock still exists. i think that in my case, i need the lock to be released when the task is accepted, not when it’s finished. Sure, i will have a case where the same task is being run simultaneously, but the first task’s results are already going to be stale before the task is completed anyway.

Celery deals with these different scenarios with acks_late, so maybe one approach is to release the lock in conjunction with task acknowledgement. Otherwise, an additional setting is desirable, so i can have the lock released during the early acknowledgment, rather than after the task is completed.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Fan-Gongcommented, Sep 14, 2020

hi @steinitzu, do we have any update on this? like having release_lock(celery_app, task_id) ? Thanks!

0reactions
utapyngocommented, Jul 6, 2021

see cameronmaske/celery-once which has unlock_before_run

celery-once seems abandoned, there is no activity since 2019.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring lock tasks - XebiaLabs documentation
Click the Release tab. From the Show dropdown, select Release flow; Click menu button on the right side of a task or grouping....
Read more >
How to unlock objects from a Released Task? - SAP Community
Go to Tcode SE03. You have an option there as Unlock object. Enter your request no. and the task no. and execute to...
Read more >
Lock or unlock a project, task, or issue preference for subgroups
Lock or unlock a group project, task, or issue preference​​ In the left panel, click Project Preferences or Tasks & Issues Preferences. On...
Read more >
Set a task start or finish date (constraint) for a task
Click Task Information​​ , and then click the Advanced tab. Enter the deadline date in the Deadline box. Tip: If you decide later...
Read more >
Restrict or lock a task for editing - Wrike Help Center
Basic Info: It would be amazing if there were a check-box or a task menu setting to mark a task as "locked for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found