Commits

Jason R. Coombs committed 03a56aa

Moved channel list cache out of parent and into MongoDB class, because sqlite can't handle queries in another thread.

Comments (0)

Files changed (1)

pmxbot/logging.py

 		self._message(channel, nick, msg)
 
 	def list_channels(self):
-		# channel listing can be expensive, so returned a cached result and
-		#  refresh the cache in the background.
-		def update_cache():
-			self._channel_cache = self._list_channels()
-		if not '_channel_cache' in vars(self):
-			update_cache()
-		else:
-			threading.Thread(target = update_cache).start()
-		return self._channel_cache
+		return self._list_channels()
 
 class SQLiteLogger(Logger, storage.SQLiteStorage):
 
 			alllines.extend(context)
 		return matches
 
+	def list_channels(self):
+		# channel listing can be expensive, so returned a cached result and
+		#  refresh the cache in the background.
+		def update_cache():
+			self._channel_cache = self._list_channels()
+		if not '_channel_cache' in vars(self):
+			update_cache()
+		else:
+			threading.Thread(target = update_cache).start()
+		return self._channel_cache
+
 	def _list_channels(self):
 		return self.db.distinct('channel')