useMojolicious::Lite;use5.20.0;useexperimental'signatures';useMojo::Utilqw(steady_time);#pluginMinion=>{File=>'/home/bpm/playground/minion.db'};pluginMinion=>{Pg=>'postgresql://was_not:the_password@127.0.0.1/jobs'};app->minion->add_task(email_photo=>sub($job,$photo){$job->app->log->debug(qq{Receivedmessage$photo:}.steady_time);select(undef,undef,undef,rand);$job->app->log->debug(qq{Processdmessage$photo:}.steady_time);});app->minion->add_task(convert_photo=>sub($job,$photo){$job->app->log->debug(qq{Receivedmessage$photo:}.steady_time);select(undef,undef,undef,rand);$job->app->log->debug(qq{Processdmessage$photo:}.steady_time);});app->minion->add_task(resize_photo=>sub($job,$photo){$job->app->log->debug(qq{Receivedmessage$photo:}.steady_time);select(undef,undef,undef,rand);$job->app->log->debug(qq{Processdmessage$photo:}.steady_time);});app->minion->add_task(crop_photo=>sub($job,$photo){$job->app->log->debug(qq{Receivedmessage$photo:}.steady_time);select(undef,undef,undef,rand);$job->app->log->debug(qq{Processdmessage$photo:}.steady_time);});app->minion->add_task(independent=>sub($job,$time){$job->app->log->debug(qq{Receivedmessage$time:}.steady_time);select(undef,undef,undef,rand);$job->app->log->debug(qq{Processdmessage$time:}.steady_time);});get'/'=>sub{my$c=shift;$c->render(json=>{number=>4});};get'/photo'=>sub($c){my$time=steady_time;$c->minion->enqueue_dependent([convert_photo=>["yippie.png: $time"]],[resize_photo=>["yippie.png: $time"]],[crop_photo=>["yippie.png: $time"]],[email_photo=>["yippie.png: $time"]],);$c->minion->enqueue("independent",[$time]);$c->render(text=>'Your photo will be done soon.');};app->start;
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.