Hey all,
is there a way to detect "(!) timer drift -- spun X minutes" i have a join flood protection script that i want to disable when this happens because it will mistake normal joins with floods. i have a lag check incorporated in the script, it works fine when the bot is lagging due to connection problem but when the eggdrop process by it self is having problems (CPU time or whatever) my lag check fails since it can't run.
now if there is a bind or something to detect "(!) timer drift -- spun X minutes" then it would be more effective than having a lag check every x minutes.
The only thing that will trigger after 'timer drift' is the HOOK_MINUTELY (once for each minute "missed"). This in its turn will trigger a check for time-bindings, so I guess this might be a way of writing a detector of some sort (checking if a time-binding triggers several times within a very short timespan).
There is, however, no direct hook or trigger for timer drift, so you'll be forced to write your own detector.
- Your bot could have been swapped out of memory for a while, or for
some reason the computer could have stopped letting the bot run. Once
a minute, Eggdrop does a few maintenance things, including counting
down any active Tcl timers. If for some reason, several minutes pass
without Eggdrop being able to do this, it logs this message to let
you know what happened. It's generally a bad thing, because it means
that the system your bot is on is very busy, and the bot can hardly
keep track of the channel very well when it gets swapped out for
minutes at a time.
- On some systems (at least Linux), if the DNS your bot is using to
lookup hostnames is broken and *very* slow in responding (this can
occur if the DNS server's uplink doesn't exist), then you will get
4-5 minute timer drifts continuously. This can be fixed by loading
the dns module.
- The clock on your machine has just been changed. It may have been
running behind by several minutes and was just corrected.
I'm afraid that will not work, as the timestamp used to trigger the time-binding is "current" even in the timer-drift condition.
The effect however, would be that the time-binding will trigger multiple times with the same minute-value.
bind time - * checkdrift
set _lastmin 0
proc checkdrift {args} {
global _lastmin timerdrift
if {${_lastmin} == [lindex $args 0]} {
set timerdrift 1
} {
set timerdrift 0
set _lastmin [lindex $args 0]
}
}
I believe this code would set the globalspace variable timerdrift to 1 when a timerdrift conditon occurs, and resets it to 0 upon next "proper" HOOK_MINUTELY hook. However, this code has not been tested either.
Worth noting, one of the most common causes for timerdrifts are tcl-scripts that do some heavy data manipulation (or invokes an external application to do it, such as pisg), or ftp-scripts. This is due to the fact that eggdrop only uses one tcl-interpreter and no further threads; and will only execute one (tcl) command at any single time.