Skip to content

Instantly share code, notes, and snippets.

/lock_test.pl Secret

Created October 20, 2017 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/75f40e9263935d930a8701e1ea057d9d to your computer and use it in GitHub Desktop.
Save anonymous/75f40e9263935d930a8701e1ea057d9d to your computer and use it in GitHub Desktop.
use Mojo::Base -strict;
use Minion;
my $minion = Minion->new(Pg => 'postgresql://tester:testing@/test');
$minion->backend->pg->migrations->migrate(0)->migrate if $ARGV[0];
$minion->add_task(foo => sub { });
$minion->add_task(bar => sub { });
$minion->reset;
# Lock
my $i = 0;
warn ++$i . "\n" and $minion->lock('foo', 3600, {limit => 1}) while 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment