mojolicious/mojo

Helper process support for Mojo::Server::Daemon/Prefork

オープン

#1,694 opened on 2021/02/07

 (2 件のコメント) (0 件のリアクション) (0 人の担当者)Perl (591 件のフォーク)auto 404
feature requesthelp wanted

Repository metrics

Stars
 (2,745 個のスター)
PR merge metrics
 (PR metrics pending)

説明

The motivation for this is https://github.com/mojolicious/minion/issues/76. But there are many other use cases for running arbitrary code in a persistent helper process next to the Mojolicious application server.

While forking such a process from a before_server_start hook is fairly trivial, making it work with Mojo::Server::Daemon as well as Mojo::Server::Prefork is not. Especially stopping the process together with the main application server process is tricky. It will have to work with Mojo::Server::Morbo and Mojo::Server::Hypnotoad too. There also needs to be some way to handle failures in the helper process (at the very least logging the exit code/signal as an error). And multiple helper processes should not interfere with each other of course.

API wise, we don't need anything fancy, a simple plugin should do just fine for now.

plugin HelperProcess => {run => sub ($app) {
  while (1) {
    sleep 1;
    $app->log->debug("Helper process $$ is still running");
  }
}};

Process management is the main priority and needs to be rock solid. With very good test coverage.

コントリビューターガイド