For one of my server processes, I''ve got a disconnect timer going that I want to prevent from firing for certain conditions. ( EM::add_timer(time) { close_connection } ) Is there away to stop a timer from firing or should I just set a flag that''s checked in the block, aka: EM::add_timer(time) { close_connection if @actually_close_connection } Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20071130/4bd1962a/attachment.html
On Nov 30, 2007 11:39 AM, Jason Roelofs <jameskilton at gmail.com> wrote:> For one of my server processes, I''ve got a disconnect timer going that I > want to prevent from firing for certain conditions. ( EM::add_timer(time) { > close_connection } ) > > Is there away to stop a timer from firing or should I just set a flag > that''s checked in the block, aka: > > EM::add_timer(time) { close_connection if @actually_close_connection } > >timer = EM::Timer.new(time) {your_code} This class has a #cancel method. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20071130/631a33b8/attachment.html
On Nov 30, 2007 4:27 PM, Francis Cianfrocca <garbagecat10 at gmail.com> wrote:> On Nov 30, 2007 11:39 AM, Jason Roelofs <jameskilton at gmail.com> wrote: > > > For one of my server processes, I''ve got a disconnect timer going that I > > want to prevent from firing for certain conditions. ( EM::add_timer(time) { > > close_connection } ) > > > > Is there away to stop a timer from firing or should I just set a flag > > that''s checked in the block, aka: > > > > EM::add_timer(time) { close_connection if @actually_close_connection } > > > > > > > timer = EM::Timer.new(time) {your_code} > > This class has a #cancel method. >Awesome, that worked. I think the documentation needs to be updated to mention that you don''t need add_timer to add a timer to the system, just creating one manually will add it to the timer queue. Jason -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20071201/0b518d02/attachment.html