Fixed a bug in ChannelDBHandler that *somehow* would cause a wrong database to be returned from getDb.

This commit is contained in:
Jeremy Fincher 2003-11-21 23:32:24 +00:00
parent d83cf1450f
commit e7fd4cafbb

View File

@ -116,8 +116,10 @@ class ChannelDBHandler(object):
def getDb(self, channel):
"""Use this to get a database for a specific channel."""
if channel not in self.dbCache or \
threading.currentThread() is not world.mainThread:
currentThread = threading.currentThread()
if channel not in self.dbCache and currentThread == world.mainThread:
self.dbCache[channel] = self.makeDb(self.makeFilename(channel))
if currentThread != world.mainThread:
db = self.makeDb(self.makeFilename(channel))
else:
db = self.dbCache[channel]