-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Lock] Add a TTL to refresh lock #26232
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
Conversation
ded0225
to
89a93ba
Compare
89a93ba
to
3b1f328
Compare
* @throws LockConflictedException If the lock is acquired by someone else | ||
* @throws LockAcquiringException If the lock can not be refreshed | ||
*/ | ||
public function refresh(); | ||
public function refresh(/* $ttl = null */); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not such this is the right way to keep BC layer on interfaces. ping @nicolas-grekas
Is there a way to trigger a deprecation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can trigger a deprecation in the interface like e8351d8#diff-7994cccf0d9c75a5a481e1240a159cce
Thank you @jderusse. |
This PR was merged into the 4.1-dev branch. Discussion ---------- [Lock] Add a TTL to refresh lock | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | see LockInterface's comment | Tests pass? | yes | Fixed tickets | NA | License | MIT | Doc PR | NA Using remote locks in long processes needs to defines a fined grain refresh TTL. For instance, when looping over a long list of jobs we can extends the live of the lock by few seconds before processing each item. But when the the jobs is splitted and each part to take the same time, we can not define the best TTL Exemple ``` $lock->acquire(); $this->2minutesJob(); $lock->refresh(); $this->5minutesJob(); $lock->refresh(); $this->1minutesJob(); ``` The purpose of this PR is to be able to override the default TTL ``` $lock->acquire(); $lock->refresh(120); $this->2minutesJob(); $lock->refresh(300); $this->5minutesJob(); $lock->refresh(60); $this->1minutesJob(); ``` Commits ------- 3b1f328 Add a TTL to refresh lock
Using remote locks in long processes needs to defines a fined grain refresh TTL. For instance, when looping over a long list of jobs we can extends the live of the lock by few seconds before processing each item.
But when the the jobs is splitted and each part to take the same time, we can not define the best TTL
Exemple
The purpose of this PR is to be able to override the default TTL