Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@avrono
Last active June 23, 2016 12:12
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 avrono/1f42dd0a0be9393bbda1a8d30a4f2269 to your computer and use it in GitHub Desktop.
Save avrono/1f42dd0a0be9393bbda1a8d30a4f2269 to your computer and use it in GitHub Desktop.
app->minion->add_task(poke_mojo => sub {
my $job = shift;
#$job->app->ua->get('mojolicious.org');
sleep 15;
my $log = Mojo::Log->new;
$log->debug('We have poked mojolicious.org for a visitor');
});
# Perform job in a background worker process
get '/minion' => sub {
my $c = shift;
$c->minion->enqueue('poke_mojo');
$c->render(text => 'We will poke mojolicious.org for you soon.');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment