Cleaner consumers
This commit is contained in:
parent
e5741ce1cb
commit
a8ce37a372
@ -266,7 +266,7 @@ class IRCServer(server.Server):
|
|||||||
else:
|
else:
|
||||||
print ("\033[1;35mWarning:\033[0m Message truncated due to size (%d ; max : 442) : %s" % (len(line), line))
|
print ("\033[1;35mWarning:\033[0m Message truncated due to size (%d ; max : 442) : %s" % (len(line), line))
|
||||||
traceback.print_stack()
|
traceback.print_stack()
|
||||||
self.s.send (("%s %s :%s%s" % (cmd, channel, line[0:442]+"...", endl)).encode ())
|
self.s.send (("%s %s :%s%s" % (cmd, channel, line[0:442]+"<…>", endl)).encode ())
|
||||||
|
|
||||||
def send_msg_usr(self, user, msg):
|
def send_msg_usr(self, user, msg):
|
||||||
"""Send a message to a user instead of a channel"""
|
"""Send a message to a user instead of a channel"""
|
||||||
|
@ -136,8 +136,10 @@ class Consumer(threading.Thread):
|
|||||||
while not self.stop:
|
while not self.stop:
|
||||||
stm = self.context.cnsr_queue.get(True, 20)
|
stm = self.context.cnsr_queue.get(True, 20)
|
||||||
stm.run(self.context)
|
stm.run(self.context)
|
||||||
|
self.context.cnsr_queue.task_done()
|
||||||
|
|
||||||
except queue.Empty:
|
except queue.Empty:
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
self.context.cnsr_thrd_size -= 2
|
self.context.cnsr_thrd_size -= 2
|
||||||
|
self.context.cnsr_thrd.remove(self)
|
||||||
|
Loading…
Reference in New Issue
Block a user