Add beforeJobRun Hook to Support Distributed Locking in Multi-Worker Environments #13169
lukyfebrianto
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We're currently running our Payload server with multiple workers (Node processes) for scalability. We've observed an issue where both workers are picking up and running the same job simultaneously, especially for scheduler jobs.
To address this, it would be incredibly helpful if Payload supported a beforeJobRun hook (or similar), which runs before the job execution begins. This would allow us to implement distributed locking (e.g., via Redis) to ensure that only one worker acquires the lock and proceeds with running the job.
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions