Excplicitely acquire the warning lock to release it only when we need to.

This commit is contained in:
Vgr E.Barry 2015-02-22 19:52:21 -05:00
parent 19760a0ea7
commit 425919ffa5

View File

@ -993,7 +993,8 @@ def toggle_altpinged_status(nick, value, old=None):
var.PING_IF_NUMS[old].remove(cloak)
def join_timer_handler(cli):
with var.WARNING_LOCK:
var.WARNING_LOCK.acquire() # need to do this instead of the context manager
var.PINGING_IFS = True
to_ping = []
pl = var.list_players()
@ -1053,6 +1054,7 @@ def join_timer_handler(cli):
if to_ping:
to_ping.sort(key=lambda x: x.lower())
cli.msg(botconfig.CHANNEL, "PING! {0} players! {1}".format(len(pl), " ".join(to_ping)))
var.WARNING_LOCK.release()
cli.who(botconfig.CHANNEL, "%nushaf")