[Otfbot-dev] [Git] OTFBot branch, master, updated. a33ffe36395d9dc5d72ab880c56cf50ef30b0e80

git version control gitrepo at otfbot.org
Mo Nov 1 13:49:33 CET 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "OTFBot".

The branch, master has been updated
       via  a33ffe36395d9dc5d72ab880c56cf50ef30b0e80 (commit)
      from  716fb5133cfb6ee15d006c99cdbdbedc14e212c6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a33ffe36395d9dc5d72ab880c56cf50ef30b0e80
Author: allo <allo at laxu.de>
Date:   Mon Nov 1 13:49:21 2010 +0100

    lock for the buffer

diff --git a/otfbot/plugins/ircClient/log.py b/otfbot/plugins/ircClient/log.py
index 7cc6b34..643b99a 100644
--- a/otfbot/plugins/ircClient/log.py
+++ b/otfbot/plugins/ircClient/log.py
@@ -23,6 +23,7 @@
 """
 
 from twisted.internet import reactor
+from threading import Lock
 
 from otfbot.lib import chatMod
 from otfbot.lib.pluginSupport.decorators import callback
@@ -66,6 +67,7 @@ class Plugin(chatMod.chatMod):
         self.logs=[]
         self.privateLogs=[]
         self.stopThread=False
+        self.bufferLock=Lock()
 
     def timemap(self):
         return {'y': self.ts("%Y"), 'm': self.ts("%m"), 'd': self.ts("%d")}
@@ -113,20 +115,26 @@ class Plugin(chatMod.chatMod):
                 file.close()
         while not self.stopThread:
             time.sleep(1)
+            self.bufferLock.acquire()
             logs=copy.copy(self.logs)
             self.logs=[]
             privateLogs=copy.copy(self.privateLogs)
             self.privateLogs=[]
+            self.bufferLock.release()
             for call in logs:
                 real_log(self, call[0], call[1], call[2])
             for call in privateLogs:
                 real_logPrivate(self, call[0], call[1])
 
     def log(self, channel, string, timestamp=True):
+        self.bufferLock.acquire()
         self.logs.append((channel, string, timestamp))
+        self.bufferLock.release()
 
     def logPrivate(self, user, mystring):
+        self.bufferLock.acquire()
         self.privateLogs.append((user, mystring))
+        self.bufferLock.release()
 
     def openLog(self, channel):
         self.channels[string.lower(channel)] = 1
-----------------------------------------------------------------------

Summary of changes:
 otfbot/plugins/ircClient/log.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
OTFBot



Mehr Informationen über die Mailingliste Otfbot-dev