Hello Sebastian,
thanks.
i already corrected it and moved it to the worker process.
Also i solved my problem by using the retry_job if the lock is active which
works.
Rgds.
Hans.
Am Donnerstag, 29. Juni 2017 09:42:02 UTC+2 schrieb sri:
>
> > $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);
> > });
>
> You can't use the finished and failed events from inside the task.
>
> --
> Sebastian Riedel
> http://mojolicio.us
> http://github.com/kraih
> http://twitter.com/kraih
>
--
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.