Skip to content

Fixed timer lifespan in 2013 advent cal async example#18

Open
nrdvana wants to merge 1 commit into
perl-catalyst:masterfrom
nrdvana:master
Open

Fixed timer lifespan in 2013 advent cal async example#18
nrdvana wants to merge 1 commit into
perl-catalyst:masterfrom
nrdvana:master

Conversation

@nrdvana
Copy link
Copy Markdown

@nrdvana nrdvana commented Aug 21, 2015

This example appeared to work, but actually most requests were
having their timer cut short by the next request, because there
was only one global variable, and the program needed to hold
refs to multiple concurrent timers.

Solved in the simplest possible way by moving the timer ref
inside the timer callback to create a circular reference, though
aa better way would be to hold the timer ref in a global pool
and not form the circular ref in the first place. But, that's
more code...

This example appeared to work, but actually most requests were
having their timer cut short by the next request, because there
was only one global variable, and the program needed to hold
refs to multiple concurrent timers.

Solved in the simplest possible way by moving the timer ref
inside the timer callback to create a circular reference, though
aa better way would be to hold the timer ref in a global pool
and not form the circular ref in the first place.  But, that's
more code...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant