]> jfr.im git - erebus.git/commitdiff
fix sql norecurse
authorzonidjan <redacted>
Wed, 4 Oct 2017 23:15:12 +0000 (18:15 -0500)
committerzonidjan <redacted>
Wed, 4 Oct 2017 23:15:12 +0000 (18:15 -0500)
erebus.py

index cb320a66154690234e8b866a1ad206112839b195..90e13898fe077e47167360f4b80d4c17ac7144a7 100644 (file)
--- a/erebus.py
+++ b/erebus.py
@@ -3,7 +3,7 @@
 # Erebus IRC bot - Author: John Runyon
 # main startup code
 
-import os, sys, select, MySQLdb, MySQLdb.cursors, time, random
+import os, sys, select, MySQLdb, MySQLdb.cursors, time, random, gc
 import bot, config, ctlmod
 
 class Erebus(object): #singleton to pass around
@@ -253,8 +253,11 @@ class Erebus(object): #singleton to pass around
 
 class MyCursor(MySQLdb.cursors.DictCursor):
        def execute(self, *args, **kwargs):
-               if 'norecurse' in kwargs: norecurse = kwargs['norecurse']
-               else: norecurse = False
+               if 'norecurse' in kwargs:
+                       norecurse = kwargs['norecurse']
+                       del kwargs['norecurse']
+               else:
+                       norecurse = False
                main.log("[SQL]", "?", "MyCursor.execute(self, %s, %s)" % (', '.join([repr(i) for i in args]), ', '.join([str(key)+"="+repr(kwargs[key]) for key in kwargs])))
 #              print "%09.3f [SQL] [#] MyCursor.execute(self, %s, %s)" % (time.time() % 100000, ', '.join([repr(i) for i in args]), ', '.join([str(key)+"="+repr(kwargs[key]) for key in kwargs]))
                try:
@@ -278,6 +281,9 @@ def setup():
 
        cfg = config.setup('bot.config')
 
+       if int(cfg.get('debug', 'gc', default=0)) == 1:
+               gc.set_debug(gc.DEBUG_LEAK)
+
        pidfile = open(cfg.pidfile, 'w')
        pidfile.write(str(os.getpid()))
        pidfile.close()