mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +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.
|
"""A class to handle database stuff for individual channels transparently.
|
||||||
"""
|
"""
|
||||||
suffix = '.db'
|
suffix = '.db'
|
||||||
|
threaded = False
|
||||||
def __init__(self, suffix='.db'):
|
def __init__(self, suffix='.db'):
|
||||||
self.dbCache = ircutils.IrcDict()
|
self.dbCache = ircutils.IrcDict()
|
||||||
suffix = self.suffix
|
suffix = self.suffix
|
||||||
@ -40,10 +41,14 @@ class ChannelDBHandler(object):
|
|||||||
|
|
||||||
def getDb(self, channel):
|
def getDb(self, channel):
|
||||||
try:
|
try:
|
||||||
return self.dbCache[channel]
|
if self.threaded:
|
||||||
|
return self.makeDb(self.makeFilename(channel))
|
||||||
|
else:
|
||||||
|
return self.dbCache[channel]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
db = self.makeDb(self.makeFilename(channel))
|
db = self.makeDb(self.makeFilename(channel))
|
||||||
self.dbCache[channel] = db
|
if not self.threaded:
|
||||||
|
self.dbCache[channel] = db
|
||||||
return db
|
return db
|
||||||
|
|
||||||
def die(self):
|
def die(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user