Subject: | Does not increase session refcount |
I've created a scheduler class as a POE session, but I found that my
scheduler entry components never fired unless the kernel was also doing
something else, like servicing a periodic alarm (which is how my
scheduler used to be done until I switched it to PoCo-Cron). Being a
relative noob at POE, I don't have a patch, but I'm told that it needs
to increase the session refcount. I copied the relevant IRC log on #poe:
<sproingie> hm. i'm trying to use POE::Component::Cron, but it seems
that the cron tasks only run if I have an alarm outstanding
<sproingie> so i've set up my session to do a 'tick' every 10 seconds
using $_[KERNEL]->alarm('tick')
<sproingie> but i don't really know why I need that, and it bothers me.
anyone know?
<pravus> sproingie: perhaps the session you are using is getting reaped
when not using an alarm? perhaps you should set an alias or increment
its refcount?
<integral> at a guess, POE::Component::Cron isn't putting an extref on
the sessions it does callbacks to
<sproingie> i'm not well versed in POE, how would I go verifying that?
<sproingie> or where can I find a simple example of a component that
does properly add an extref?
<integral> I think I'm right from reading the source now. A work around
is to put an alias on your session.
<sproingie> so just put $poe_kernel->alias_set( 'dummy' ) somewhere in
my startup state?
<BinGOs> that would do it, yeah.
<BinGOs> that said, like integral pointed out PoCo-Cron should be
increasing the refcount of the requesting sessions
<sproingie> i could file a bug, but i wouldn't know enough to put in a fix
<integral> copy this IRC conversation to the bug :-)