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.
t/lib/DBIEngineTest.pm view on Meta::CPAN
An SQL query that frees a lock. Required.
=item C<wait_time>
Time to pass to C<lock_timeout> to wait for a lock to time out. Defaults to
C<0.005>.
=item C<async_free>
Boolean indicating whether the freeing of a lock is performed asynchronously.
Required only for engines that don't free locks synchronously.
=back
=back
=cut
sub run {
my ( $self, %p ) = @_;
( run in 1.159 second using v1.01-cache-2.11-cpan-ff066701436 )