The startup method is run in the manager process before any forking. If you
want something to occur in each worker, you can run it in a
Mojo::IOLoop->next_tick callback. However note that this will also run in
each worker that is started later, to replace workers that reach their
max_accepts or stop responding.
-Dan

On Fri, Feb 23, 2018 at 2:48 AM, Michael Fung <hkuser2...@gmail.com> wrote:

> Hi All,
>
> I run my app like:
>
> ./script/web_api prefork -w 4 -c 100 -l "http://[::]:8808";
>
> In the startup section, I run a recurring timer and log an entry to the
> log file. However, the '*web api started*' log entry does not repeat 4
> times.
>
>
>     $log->info('web api started');
>
>     Mojo::IOLoop->recurring(60 => sub {
>         $log->info($$.' - do refresh_secrets');
>         $refresh_secrets->();
>     });
>
>
> Log excerpt:
>
> [Fri Feb 23 15:19:22 2018] [info] web api started
> [Fri Feb 23 15:20:22 2018] [info] 9471 - do refresh_secrets
> [Fri Feb 23 15:20:22 2018] [info] 9468 - do refresh_secrets
> [Fri Feb 23 15:20:22 2018] [info] 9469 - do refresh_secrets
> [Fri Feb 23 15:20:22 2018] [info] 9470 - do refresh_secrets
>
>
> Am I doing something wrong?
>
>
> --
> 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 mojolicious+unsubscr...@googlegroups.com.
> To post to this group, send email to mojolicious@googlegroups.com.
> Visit this group at https://groups.google.com/group/mojolicious.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to