Skip to content

Instantly share code, notes, and snippets.

@zoffixznet

zoffixznet/pl.pl Secret

Created November 4, 2017 17:54
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 zoffixznet/ee3262193129cae94c5750a84919b55d to your computer and use it in GitHub Desktop.
Save zoffixznet/ee3262193129cae94c5750a84919b55d to your computer and use it in GitHub Desktop.
use 5.012;
use Minion;
use Minion::Backend::SQLite;
my $minion = Minion->new(SQLite => 'sqlite:test.db');
$minion->add_task(do_unique_stuff => sub {
my ($job, @args) = @_;
return $job->retry({delay => 10})
unless my $guard = $minion->guard('fragile_backend_service', 7200, {limit => 1});
say "DOING STUFF!!";
sleep 1;
});
$minion->enqueue(do_unique_stuff => []) for 0..10;
say "doing stuff";
$minion->perform_jobs;
say "done";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment