Hi,
i highly appreciate your work for minion and the latest version which
supports locks.
i really need something like queuing by using the lock mech. Before i used
file locks via flock.
I have a system which only can process one job by another.
The problem i have is, that $minio->lock return a deadlock situation.
A simple demo job:
$app->minion->add_task(demo_job => sub {
my $job = shift;
my $retval = {};
sleep 1 until $app->minion->lock('demo_job', 7200);
$job->on(finished => sub {
my ($job, $result) = @_;
my $debugger = $app->debug_logger;
$debugger->debug(sprintf("Job %d with task %s finished\n", $job->
id, $job->task ));
$app->minion->unlock('demo_job');
});
$job->on(failed => sub {
my ($job, $err) = @_;
my $debugger = $app->debug_logger;
$debugger->debug(sprintf("Job %d with task %s failed %s\n", $job->
id, $job->task, $err ));
$app->minion->unlock('demo_job');
});
$retval->{data}->[0]->{demo_job} = int(rand(1000));
$retval->{success} = Cpanel::JSON::XS::true();
return $job->finish($retval);
});
if i enqueue e.g. 8 jobs, some of them fail with:
"result" : "DBD::Pg::st execute failed: ERROR: deadlock detected\nDETAIL:
Process 43250 waits for ExclusiveLock on relation 19753 of database 19627;
blocked by process 43294.\nProcess 43294 waits for ExclusiveLock on
relation 19753 of database 19627; blocked by process 43250.\nHINT: See
server log for query details.\nCONTEXT: SQL statement \"lock table
minion_locks in exclusive mode\"\nPL/pgSQL function
minion_lock(text,integer,integer) line 6 at SQL statement at
/opt/perl5/perls/perl-5.24.1t/lib/site_perl/5.24.1/Minion/Backend/Pg.pm
line 90.\n"
I thought when using lock and it's locked than i can wait until the lock is
free ?
If that's not possible i will return to my working flock mech.
Perhaps anyone can point me in the right direction.
Kind regards.
Hans
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.