Skip to content

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

Closed
@brandonkelly

Description

@brandonkelly

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions