cinchrb / cinch

The IRC Bot Building Framework
http://www.rubydoc.info/gems/cinch
MIT License
1k stars 180 forks source link

Instantly update timer interval when using Timer#interval= #104

Open dominikh opened 11 years ago

mrageh commented 11 years ago

Hi I don't understand exactly what you mean with that question?

dominikh commented 11 years ago

I did not ask a question, I filed a task.

Currently, when using Timer#interval= to change a timer's interval, it will still use the previous interval for the next tick, before it switches to the new interval.

mrageh commented 11 years ago

Hi Domink I did not intend to offend am just a beginner, I have tried to find this timer#interval to see if i can fix it and logically speaking should it not be in timer.rb? Only been programming for 1 month and 2 weeks :)

dominikh commented 11 years ago

Not offended here.

Yes, it's in /lib/cinch/timer.rb. Currently it's a plain attribute accessor (attr_accessor :interval).

mrageh commented 11 years ago

And if I understand correctly you want it to instantly update?

dominikh commented 11 years ago

I want that setting a new interval will abort the current sleep period and start with the new interval, yes.

Currently, if you have a timer with an interval of say 1 hour, and after 2 minutes you change the interval to 1 second, it will still take 58 minutes before the timer fires and uses the new interval.