Skip to content

PgsqlMutex::acquireLock() should support $timeout with sleep() #16939

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

Closed
brandonkelly opened this issue Dec 5, 2018 · 3 comments
Closed

PgsqlMutex::acquireLock() should support $timeout with sleep() #16939

brandonkelly opened this issue Dec 5, 2018 · 3 comments
Labels
status:ready for adoption Feel free to implement this issue. type:bug Bug
Milestone

Comments

@brandonkelly
Copy link
Contributor

What steps will reproduce the problem?

  1. Call yii\mutex\PgsqlMutex::acquireLock() passing in a non-null $timeout value.

What is the expected result?

The lock should wait up to the number of seconds defined by $timeout before giving up on acquiring the lock.

What do you get instead?

An InvalidArgumentException is thrown, because PostgreSQL doesn’t support lock timeouts like MySQL and Oracle do.

I realize that this is intended behavior so not exactly a bug, but why can’t PgsqlMutex just fall back on the sleep() function like FileMutex and yii\redis\Mutex do?

Additional info

Q A
Yii version 2.0.15.1
PHP version 7.2
Operating system Ubuntu 16.04.1
@samdark
Copy link
Member

samdark commented Dec 5, 2018

I think it can do so.

@samdark samdark added type:bug Bug status:ready for adoption Feel free to implement this issue. labels Dec 5, 2018
@rob006
Copy link
Contributor

rob006 commented Dec 5, 2018

This is already fixed by #16839.

@rob006 rob006 closed this as completed Dec 5, 2018
@samdark samdark added this to the 2.0.16 milestone Dec 5, 2018
@brandonkelly
Copy link
Contributor Author

Oh awesome, thanks @rob006!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready for adoption Feel free to implement this issue. type:bug Bug
Projects
None yet
Development

No branches or pull requests

3 participants