Skip to content
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

[10.x] Add function to validate if a lock is owned by the current owner. #49244

Conversation

Joostb
Copy link
Contributor

@Joostb Joostb commented Dec 5, 2023

This pr adds a public function isOwner to the Cache/Lock.php class. This can be used to determine if a restored lock is owned by the current owner. Currently it is not possible to determine if a restoredLock is owned by the given owner, except when releasing it.

We ran into a problem when we wanted to validate on the queue if we still had the lock on a specific key. We pass the $owner to the job, and can currently release the lock using restoreLock($key, $owner)->release(), but we have no way of validating whether the lock is still viable (without releasing it).

This is backwards-compatible because it only adds a function to the api, not changing any existing functions.

@driesvints driesvints changed the title Add function to validate if a lock is owned by the current owner. [10.x] Add function to validate if a lock is owned by the current owner. Dec 5, 2023
@taylorotwell
Copy link
Member

Can't add to contracts on patch releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants