Re: [Mojolicious] strange behaviour with prefork

2018-02-23 Thread Michael Fung
Pub/Sub over Redis sounds good to me. Thanks again Dan. On Saturday, February 24, 2018 at 1:11:16 AM UTC+8, Dan Book wrote: > > There are many options for synchronizing data between workers. The most > common is to use a database, but you can also use realtime methods like > pubsub over redis,

Re: [Mojolicious] strange behaviour with prefork

2018-02-23 Thread Dan Book
There are many options for synchronizing data between workers. The most common is to use a database, but you can also use realtime methods like pubsub over redis, postgres, or Mercury. -Dan On Fri, Feb 23, 2018 at 7:24 AM, Michael Fung wrote: > Many thanks, Dan. I am sorry

Re: [Mojolicious] strange behaviour with prefork

2018-02-23 Thread Dan Book
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

Re: [Mojolicious] strange behaviour with prefork

2018-02-23 Thread Michael Fung
Many thanks, Dan. I am sorry I did not read the docs thoroughly enough. BTW, I wonder how the others do to synchronize secrets(or whatever data) between workers. My current code still leave a small time window for workers to be out of sync when they refresh the secrets. I use the secrets for