App-Sqitch
view release on metacpan or search on metacpan
lib/App/Sqitch/Engine/pg.pm view on Meta::CPAN
# until timeout.
sub wait_lock {
my $self = shift;
# Yugabyte does not support advisory locks.
# https://github.com/yugabyte/yugabyte-db/issues/3642
# Use pessimistic locking when it becomes available.
# https://github.com/yugabyte/yugabyte-db/issues/5680
return 1 if $self->_provider ne 'postgres';
# Asynchronously request a lock with an indefinite wait.
my $dbh = $self->dbh;
$dbh->do(
'SELECT pg_advisory_lock(75474063)',
{ pg_async => DBD::Pg::PG_ASYNC() },
);
# Use _timeout to periodically check for the result.
return 1 if $self->_timeout(sub { $dbh->pg_ready && $dbh->pg_result });
# Timed out, cancel the query and return false.
( run in 0.227 second using v1.01-cache-2.11-cpan-0d8aa00de5b )