Queues

From Eggdrop Wiki

(Difference between revisions)
Jump to: navigation, search
m (typo fix)
Line 42: Line 42:
  <div style="{{divstylenone}}">
  <div style="{{divstylenone}}">
  <source lang=tcl>
  <source lang=tcl>
-
  package require Eggdrop 1.6.20
+
  package require eggdrop 1.6.20
  bind out - "% queued" circumvent_queues
  bind out - "% queued" circumvent_queues
  proc circumvent_queues {queue text status} {
  proc circumvent_queues {queue text status} {

Revision as of 14:13, 16 June 2014

Contents

Eggdrop's queues

To prevent users from flooding IRC servers with commands, IRCds detect that behavior and disconnect users who do so. As a result of this, there's only so many messages that you can send to the IRCd before getting disconnected. Eggdrop attempts to solve this problem with different output queues. In order for Eggdrop to respond quickly and efficiently to important events such as kicks or mode changes, different queues have different priorities. When writing scripts for Eggdrop, it is important to use the correct queue for the message that you want to send to the IRCd.

These are the queues that are used to send messages to the IRCd that Eggdrop is connected to.

You can observe what happens to the queues with .console +v.

Overview

Queue name Tcl command Priority Bursting Recommended use case
help puthelp 3 no text in general, long text replies
server putserv 2 slightly one-line text replies, commands to the ircd in general
quick or mode putquick 1 yes urgent mode changes, kicks, bans
no queue putnow - - none

Objective

Eggdrop attempts to adapt to the IRCd throttling of messages to avoid being disconnected for Excess flood while still sending fast enough not to waste time.

General principle

Eggdrop sends one message from the queue with the highest priority every msg-rate (default: 2) seconds. The queues do not differ in speed.

Bursting

If Eggdrop had nothing to send for a while, it sends multiple messages at once for some queues.

Sending as fast as possible

A very often asked question is how to make Eggdrop send as fast as possible. This is discouraged and will disconnect your bot if it doesn't have special privileges from the IRCd!

Load this script (paste to configfile or create a scriptfile):

 package require eggdrop 1.6.20
 bind out - "% queued" circumvent_queues
 proc circumvent_queues {queue text status} {
   if {$queue eq "noqueue"} { return }; # ignore putnow "queue"
   putnow $text; # send instantly
   return 1; # delete from old queue
 }

Common mistakes

A common error is to attribute the word "quick" with "speed" and assume that queues without the word "quick" in them are inherently slow.

Consider a script that gets a lot of text from a website when asked to and outputs it to a channel. If this was put in the quick queue, Eggdrop would not be able to do anything else until all of the text had been sent to the server. This means that no mode changes, no kicks, no nothing would get through as long as that text was being processed. If the same text instead was put in the help queue, Eggdrop would still be able to not only make mode changes and kicks, but also other less-critical things such as changing the topic.

Retrieved from "http://eggwiki.org/Queues"
Personal tools