egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sendq exceeded avoiding script

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
CP1832
Halfop


Joined: 09 Oct 2014
Posts: 68

PostPosted: Thu Sep 22, 2022 8:56 pm    Post subject: Sendq exceeded avoiding script Reply with quote

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
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1021
Location: France

PostPosted: Fri Sep 23, 2022 6:14 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
CP1832
Halfop


Joined: 09 Oct 2014
Posts: 68

PostPosted: Fri Sep 23, 2022 9:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
CP1832
Halfop


Joined: 09 Oct 2014
Posts: 68

PostPosted: Sat Sep 24, 2022 12:34 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber