Initializing of worker processes

36 views
Skip to first unread message

Yuriy Zhilovets

unread,
Oct 6, 2015, 5:00:35 AM10/6/15
to Mojolicious
Hi everybody,

When I use the built-in Mojo web server, I can connect to external servers before app->start and save connections in global variables which are visible for all transaction handlers.
But when I use the Hypnotoad, I have, let's say, 5 wjorker processes and I need to initialize connections five times - for each process.
Is there some event like "Worker started" or something else which I could use?

I know that in the DB plugin modules this task is accomplished by some helper which connects to the database when the connection is needed. But this scheme does not work if I need a non-blocking connection with a following callback, for example to the RabbitMQ server.

Please point me to useful direction.

Y.Z.

sri

unread,
Oct 6, 2015, 6:33:09 AM10/6/15
to Mojolicious

Yuriy Zhilovets

unread,
Oct 6, 2015, 7:28:28 AM10/6/15
to mojol...@googlegroups.com
Mojo::IO::Loop->next_tick
Just what is needed.

Thanks, Sebastian!

2015-10-06 13:33 GMT+03:00 sri <kra...@googlemail.com>:

--
You received this message because you are subscribed to a topic in the Google Groups "Mojolicious" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mojolicious/yzLzYO0w8D8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mojolicious...@googlegroups.com.
To post to this group, send email to mojol...@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages