View previous topic :: View next topic |
Author |
Message |
CP1832 Halfop
Joined: 09 Oct 2014 Posts: 68
|
Posted: Thu Sep 22, 2022 8:56 pm Post subject: Sendq exceeded avoiding script |
|
|
I have an eggdrop that connects to several crowded channels, so every once and again, when the bot crashed or got stoned, the eggdrop would get kicked out of the network because it would exceed the sendq data limit. So to stop that, I had to set some channels to inactive and enable them one at a time. Finally, I figured out that a script should do that. The scripts sets all the bot's channels to inactive when reloading, disconnecting or reconnecting and sets its channel to active one channel at a time after n (in this example, 60) seconds. Code: | ## Delay Join ##
foreach bind [binds join:delay] {lassign $bind type flags mask num proc; unbind $type $flags $mask $proc}
foreach bind [binds inactive] {lassign $bind type flags mask num proc; unbind $type $flags $mask $proc}
set joindelay 60
bind evnt - sigterm inactive
bind evnt - sigill inactive
bind evnt - sigquit inactive
bind evnt - sighup inactive
bind evnt - disconnect-server inactive
bind evnt - loaded inactive
bind evnt - connect-server inactive
proc inactive {type} {
foreach channel [channels] {
putlog "Setting $channel to inactive"
channel set $channel +inactive
}
}
bind evnt - init-server join:delay
proc join:delay {type} {
global i joindelay
if {![info exists i]} {
set i 0
}
if { $i < [ llength [split [channels]] ] } {
if { $i == 0 } { set chan [ string range [lindex [split [channels]] $i] 1 end-1]
} else { set chan [lindex [split [channels]] $i] }
putlog "Setting $chan to active"
channel set $chan -inactive
utimer $joindelay [list join:delay type]
incr i
} else {
set i 0
}
}
putlog "Delay join" |
|
|
Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1074 Location: France
|
Posted: Fri Sep 23, 2022 6:14 pm Post subject: |
|
|
Not sure to understand why you play with unbinds. And why you bind all the events.
You can just use these two binds:
Code: | bind evnt - connect-server inactive
bind evnt - init-server join:delay |
_________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
Back to top |
|
 |
CP1832 Halfop
Joined: 09 Oct 2014 Posts: 68
|
Posted: Fri Sep 23, 2022 9:25 pm Post subject: |
|
|
CrazyCat wrote: | Not sure to understand why you play with unbinds. And why you bind all the events. | I unbind because I forget to unbind when modifying the script and the bind remains. CrazyCat wrote: | You can just use these two binds:
Code: | bind evnt - connect-server inactive
bind evnt - init-server join:delay |
| That's a good point, I'll modify that. |
|
Back to top |
|
 |
CP1832 Halfop
Joined: 09 Oct 2014 Posts: 68
|
Posted: Sat Sep 24, 2022 12:34 am Post subject: |
|
|
In order to avoid setting channels to active and inactive several times, I added a check to avoid setting its status again and again... Code: | ## Delay Join ##
foreach bind [binds active] {lassign $bind type flags mask num proc; unbind $type $flags $mask $proc}
foreach bind [binds inactive] {lassign $bind type flags mask num proc; unbind $type $flags $mask $proc}
set joindelay 60
bind evnt - connect-server inactive
proc inactive {type} {
global i
set i 0
foreach chan [channels] {
if {![channel get $chan inactive]} {
putlog "Passing to inactive $chan"
channel set $chan +inactive
}
}
}
bind evnt - init-server active
proc active {type} {
global i joindelay
if {![info exists i]} {
set i 0
}
if { $i < [ llength [split [channels]] ] } {
if { $i == 0 } { set chan [ string range [lindex [split [channels]] $i] 1 end-1]
} else { set chan [lindex [split [channels]] $i] }
if {[channel get $chan inactive]} {
putlog "Passing to active $chan"
channel set $chan -inactive
}
utimer $joindelay [list active type]
incr i
} else {
set i 0
}
}
putlog "Delay join" |
|
|
Back to top |
|
 |
|