Skip to content

Add acquire timeout support to PostgreSQLMutex #80

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

Merged
merged 11 commits into from
Jul 28, 2025

Conversation

colemanator
Copy link
Contributor

@colemanator colemanator commented Jul 8, 2025

closes #66

Add support for timeouts to PostgresSQLMutex, as mentioned in this issue #66 PostgreSQL supports a non-blocking advisory lock function.

We've needed this a few times and previously I've rolled our own lock/mutex but it'd be easier if it was in the package. Happy to work through any feedback on this one, tried to follow existing patterns, if I missed anything let me know.

@colemanator colemanator force-pushed the support_postgresql_timeout branch from 0204814 to a9f8890 Compare July 8, 2025 01:34
@colemanator colemanator marked this pull request as ready for review July 8, 2025 01:43
@colemanator colemanator force-pushed the support_postgresql_timeout branch from 4143853 to 7ee091e Compare July 11, 2025 03:00
@colemanator colemanator requested a review from mvorisek July 11, 2025 03:09
@colemanator
Copy link
Contributor Author

@mvorisek just following up on this one, please let me know if you need anything else.

@mvorisek
Copy link
Member

Please allow me to edit your PR branch:

image

PR looks good, I have prepared small CS modifications I want to push and merge then.

@colemanator
Copy link
Contributor Author

Done, had to transfer the fork out of our org for the option to become available.

@mvorisek
Copy link
Member

mvorisek commented Jul 27, 2025

The coverage discovered there is no test for the lock acquired. Please add E2E test. To MutexConcurrencyTest at least. See how flock mutex with timeout is tested there.

@colemanator
Copy link
Contributor Author

Do you want two mutex factories in MutexConcurrencyTest, one with a timeout and one without?

@mvorisek mvorisek changed the title Add Timeout Support to PostgreSQLMutex Add acquire timeout support to PostgreSQLMutex Jul 28, 2025
@mvorisek mvorisek merged commit 03f890a into php-lock:master Jul 28, 2025
33 checks passed
@mvorisek
Copy link
Member

Yes and thank you, great contribution ❤

@colemanator
Copy link
Contributor Author

@mvorisek thanks for making it happen 🙏

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.

PostgreSQL lock should support timeout
2 participants