Competing for exclusive flag among toad workers

42 views
Skip to first unread message

Matija Papec

unread,
May 13, 2016, 3:19:03 AM5/13/16
to Mojolicious
I would like to give exclusive flag to one of the workers in a way that if it gets killed, some other worker picks up the flag (possibly without recurring timer involved).

Perhaps something along the lines,

Mojo::IOLoop->flock($fh, LOCK_EX, sub{

    say "waiting was worthwhile, just got exclusive flag";
});

Please suggest plugin or perldoc reference to such functionality.



thanks in advance


Jan Henning Thorsen

unread,
May 22, 2016, 9:11:36 AM5/22/16
to Mojolicious
A more interesting questions is "why do you want this?"

This comes up from time to time, and often the right solution is to run another daemon in parallell.

Matija Papec

unread,
May 23, 2016, 5:31:17 AM5/23/16
to Mojolicious

Tnx, I think that same rule for separate server can be applied here as I need to keep one open ws client connection.


regards
Reply all
Reply to author
Forward
0 new messages