… | |
… | |
348 | |
348 | |
349 | our $SCHEDULE_INTERVAL = 10; # time the player scheduler sleeps between runs |
349 | our $SCHEDULE_INTERVAL = 10; # time the player scheduler sleeps between runs |
350 | our $SAVE_TIMEOUT = 20; # save players every n seconds |
350 | our $SAVE_TIMEOUT = 20; # save players every n seconds |
351 | |
351 | |
352 | our $SCHEDULER = cf::async_ext { |
352 | our $SCHEDULER = cf::async_ext { |
|
|
353 | my $schedule_interval = Coro::Event->timer (after => 1, interval => $SCHEDULE_INTERVAL); |
353 | while () { |
354 | while () { |
354 | Coro::Timer::sleep $SCHEDULE_INTERVAL; |
355 | $schedule_interval->next; |
355 | |
356 | |
356 | # this weird form of iteration over values is used because |
357 | # this weird form of iteration over values is used because |
357 | # the hash changes underneath us frequently, and for |
358 | # the hash changes underneath us frequently, and for |
358 | # keeps a direct reference to the value without (in 5.8 perls) |
359 | # keeps a direct reference to the value without (in 5.8 perls) |
359 | # keeping a reference, so this is prone to crashes or worse. |
360 | # keeping a reference, so this is prone to crashes or worse. |