mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Updated ChannelDBHandler to always return a new database if self.threaded is True.
This commit is contained in:
parent
ade09765bc
commit
5769e4d4cf
@ -23,6 +23,7 @@ class ChannelDBHandler(object):
|
||||
"""A class to handle database stuff for individual channels transparently.
|
||||
"""
|
||||
suffix = '.db'
|
||||
threaded = False
|
||||
def __init__(self, suffix='.db'):
|
||||
self.dbCache = ircutils.IrcDict()
|
||||
suffix = self.suffix
|
||||
@ -40,9 +41,13 @@ class ChannelDBHandler(object):
|
||||
|
||||
def getDb(self, channel):
|
||||
try:
|
||||
if self.threaded:
|
||||
return self.makeDb(self.makeFilename(channel))
|
||||
else:
|
||||
return self.dbCache[channel]
|
||||
except KeyError:
|
||||
db = self.makeDb(self.makeFilename(channel))
|
||||
if not self.threaded:
|
||||
self.dbCache[channel] = db
|
||||
return db
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user