Skip to content

Instantly share code, notes, and snippets.

@niczero
Created June 29, 2016 14:10
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 niczero/f2fe730e2562d32933a072475eb8af50 to your computer and use it in GitHub Desktop.
Save niczero/f2fe730e2562d32933a072475eb8af50 to your computer and use it in GitHub Desktop.
Attach code to the worker shutdown
#!/usr/bin/env perl
use Mojolicious::Lite;
app->config(hypnotoad => {
accepts => 1,
clients => 1,
listen => ['http://*:8818'],
requests => 1,
workers => 1
});
my $log = app->log->level('debug');
$log->debug("start");
Mojo::IOLoop->singleton->on(finish => sub { $log->debug("finish") });
get '/' => sub { shift->render(text => "index\n") };
app->start;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment