KNOWN BUGS
-We apologize for the rough edges on this software. The initial release
-was somewhat rushed by the sudden death of cia.vc in late September 2012;
-a replacement needed to be fielded immediately.
-
-* Testing has been minimal.
-
-* There is one report of unexplainedly high CPU usage by irkerd when
- processing UDP requests.
-
* Despite what the header comment implies, the URL prefix and message template
in irkerhook.py can at present only be modified by hacking the script.
1.0 @ 2012-09-27
First production version, somewhat rushed by the sudden death of cia.vc.
+1.1 @ 2012-09-28
+ Add a delay to avoid threads spinning on the empty-queue-check, eating CPU.
+
https://github.com/nenolod/irker-cia-proxy
-Due to the abrupt death of cia.vc in late September 2012 the
+Due to the abrupt death of cia.vc on September 24 2012 the
initial release of this software was a bit rushed. See the file
BUGS for known problems.
UNSEEN_TTL = 60 # Time to live, seconds since first request
CHANNEL_MAX = 18 # Max channels open per socket (default)
ANTI_FLOOD_DELAY = 0.125 # Anti-flood delay after transmissions, seconds
+ANTI_BUZZ = 0.09 # Anti-buzz delay after queue-empty check
# No user-serviceable parts below this line
import threading, Queue, SocketServer
import irc.client, logging
-version = "1.0"
+version = "1.1"
# Sketch of implementation:
#
self.connection.close()
self.connection = None
self.status = "disconnected"
+ else:
+ # Prevent this thread from hogging the CPU by pausing
+ # for just a little bit after the queue-empty check.
+ # As long as this is less that the duration of a human
+ # reflex arc it is highly unlikely any human will ever
+ # notice.
+ time.sleep(ANTI_BUZZ)
elif self.status == "disconnected" \
and time.time() > self.last_xmit + DISCONNECT_TTL:
# Queue is nonempty, but the IRC server might be down. Letting