Permalink
Browse files

Revert "irclib: Apply changes to supybot.protocols.irc.maxHistoryLeng…

…th immediately."

This reverts commit 1d2eefe.

IrcState instances are created more than five times a second! Imagine how much
memory is used (hint: 300MB five minutes after startup).
We should first try to reduce this amount.
  • Loading branch information...
1 parent 1d2eefe commit 79eeb8eb9501232e0fd65953c6ddd2dec0079dcf @ProgVal committed Dec 27, 2012
Showing with 25 additions and 19 deletions.
  1. +2 −1 locales/de.po
  2. +6 −2 locales/fi.po
  3. +3 −2 locales/fr.po
  4. +4 −2 locales/it.po
  5. +2 −1 locales/messages.pot
  6. +2 −1 src/conf.py
  7. +0 −3 src/irclib.py
  8. +6 −7 test/test_irclib.py
View
@@ -955,7 +955,8 @@ msgstr ""
#: ../src/conf.py:995
msgid ""
"Determines how many old messages the bot will\n"
-" keep around in its history."
+" keep around in its history. Changing this variable will not take effect\n"
+" until the bot is restarted."
msgstr ""
#: ../src/conf.py:1000
View
@@ -1503,9 +1503,13 @@ msgstr ""
#: src/conf.py:1019
msgid ""
"Determines how many old messages the bot will\n"
-" keep around in its history."
+" keep around in its history. Changing this variable will not take "
+"effect\n"
+" until the bot is restarted."
msgstr ""
-"Määrittää kuinka vanhoja viestejä botti pitää historiassaan."
+"Määrittää kuinka vanhoja viestejä botti pitää historiassaan. Tämän "
+"asetusarvon\n"
+" muuttaminen ei vaikuta ennen uudelleenkäynnistystä."
#: src/conf.py:1024
#, fuzzy
View
@@ -992,8 +992,9 @@ msgstr "Détermine quelle vhost le bot bindera avant de se connecter au serve
#: ../src/conf.py:1019
msgid ""
"Determines how many old messages the bot will\n"
-" keep around in its history."
-msgstr "Détermine combien de vieux messages le bot gardera dans son historique."
+" keep around in its history. Changing this variable will not take effect\n"
+" until the bot is restarted."
+msgstr "Détermine combien de vieux messages le bot gardera dans son historique. Changer cette variable ne prend effet qu'après avoir redémarré le bot."
#: ../src/conf.py:1024
msgid ""
View
@@ -1183,9 +1183,11 @@ msgstr ""
#: src/conf.py:1019
msgid ""
"Determines how many old messages the bot will\n"
-" keep around in its history."
+" keep around in its history. Changing this variable will not take effect\n"
+" until the bot is restarted."
msgstr ""
-"Determina quanti messaggi vecchi terrà il bot nella cronologia."
+"Determina quanti messaggi vecchi terrà il bot nella cronologia. La modifica\n"
+" di questa variabile non avrà effetto finché non si riavvia il bot."
#: src/conf.py:1024
msgid ""
View
@@ -982,7 +982,8 @@ msgstr ""
#: src/conf.py:1019
msgid ""
"Determines how many old messages the bot will\n"
-" keep around in its history."
+" keep around in its history. Changing this variable will not take effect\n"
+" until the bot is restarted."
msgstr ""
#: src/conf.py:1024
View
@@ -1038,7 +1038,8 @@ def makeBanmask(self, hostmask, options=None):
registerGlobalValue(supybot.protocols.irc, 'maxHistoryLength',
registry.Integer(1000, _("""Determines how many old messages the bot will
- keep around in its history.""")))
+ keep around in its history. Changing this variable will not take effect
+ until the bot is restarted.""")))
registerGlobalValue(supybot.protocols.irc, 'throttleTime',
registry.Float(1.0, _("""A floating point number of seconds to throttle
View
@@ -346,9 +346,6 @@ def __init__(self, history=None, supported=None,
nicksToHostmasks=None, channels=None):
if history is None:
history = RingBuffer(conf.supybot.protocols.irc.maxHistoryLength())
- def resize_history():
- self.history.resize(conf.supybot.protocols.irc.maxHistoryLength())
- conf.supybot.protocols.irc.maxHistoryLength.addCallback(resize_history)
if supported is None:
supported = utils.InsensitivePreservingDict()
if nicksToHostmasks is None:
View
@@ -36,8 +36,10 @@
import supybot.irclib as irclib
import supybot.ircmsgs as ircmsgs
-rawmsgs = 'foo bar baz qux quux corge grault garply waldo fred'.split()
-msgs = map(lambda x:ircmsgs.privmsg('#channel', x), rawmsgs)
+# The test framework used to provide these, but not it doesn't. We'll add
+# messages to as we find bugs (if indeed we find bugs).
+msgs = []
+rawmsgs = []
class IrcMsgQueueTestCase(SupyTestCase):
mode = ircmsgs.op('#foo', 'jemfinch')
@@ -256,7 +258,8 @@ def testNickChangesChangeChannelUsers(self):
self.failUnless(st.channels['#foo'].isOp('baz'))
def testHistory(self):
- assert len(msgs) >= 10
+ if len(msgs) < 10:
+ return
maxHistoryLength = conf.supybot.protocols.irc.maxHistoryLength
with maxHistoryLength.context(10):
state = irclib.IrcState()
@@ -269,10 +272,6 @@ def testHistory(self):
self.assertEqual(len(state.history), maxHistoryLength())
self.assertEqual(list(state.history),
msgs[len(msgs) - maxHistoryLength():])
- with maxHistoryLength.context(5):
- self.assertEqual(len(state.history), maxHistoryLength())
- self.assertEqual(list(state.history),
- msgs[len(msgs) - maxHistoryLength():])
def testWasteland005(self):
state = irclib.IrcState()

0 comments on commit 79eeb8e

Please sign in to comment.