Comments (3)
For me, I set start_automatically: false
on Timer (passed to constructor) to deal with this
from cinch.
@petertseng I've seen this happen with many timers as well. Should start_automatically: false be the default, do you think?
from cinch.
start_automatically
Interesting question. I use timers for two things:
- Do something on a regular basis. I usually use DSL
timer
method to set these.start_automatically
should probably be true here. I want the bot to keep doing the thing if it gets disconnected and reconnected. - Do something a certain time in the future once (perhaps this generalises to N times). I usually use
Timer
Helper to set these.start_automatically
should probably be false here. That will stop the bot from re-doing the thing if it gets reconnected.
I personally think unconditional start_automatically: false
would trip up too many people who use timers for the first use (automatically do something periodically).
But based on those above uses of timers, one might imagine some possible solutions:
- Keep the DSL
timer
method as-is (start_automatically: true
default). Make the HelperTimer
method default tostart_automatically: false
. - If
num_shots
is a finite number,start_automatically: false
by default. If it's infinite,start_automatically: true
by default. - Other solution I did not think of.
stop_automatically
There's an interesting snag here with the second kind of timer (do something once at some time in the future).
Let's say at t=0 I ask for a timer to fire in 300 seconds. One could reasonably expect that this timer fires at time t=300. But then the bot gets disconnected and reconnected at t=200. In that case, what should the behaviour be? If start_automatically
is false, the timer never fires. If start_automatically
is true, the timer fires at t=500 instead. Neither seems to be what was asked for. This seems important for one-shot timers since if it's scheduled once, someone probably cares about the time between schedule and the time between fire.
I just have my bot reschedule the timer at the correct remaining time on reconnect, but I guess I could have set stop_automatically
to false instead so that disconnecting doesn't stop the timer. So Cinch doesn't need to try to do the reschedule.
So based on that, maybe stop_automatically
should be given the same treatment as start_automatically
(whatever that may be).
from cinch.
Related Issues (20)
- How create an event for all message sended ? HOT 1
- Can I running In Background? HOT 3
- Site is offline HOT 1
- Cinch::Helper can't get instances of Channel and User objects HOT 5
- "Write" and "ping" irc threads still open after bot.quit HOT 1
- Uppercase CTCP commands so they always match
- Is this still maintained? HOT 3
- Method name typo cinch v2.3.3 HOT 1
- Support for reverse DCC SEND
- Sometimes on_channel handler receives message concatenated with other one
- IRCv3 tags broken if tag value contains a colon HOT 4
- backup file in gem HOT 3
- ":invite" event is not documented HOT 2
- adding proxy support HOT 1
- Bot#oper crashes the process when used specific IRCds
- Mismatch between code and released version. HOT 1
- Missing documentation for bot configuration HOT 5
- idle method always return 0 HOT 11
- SASL authentication times out HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cinch.