prevent dead lock
This commit is contained in:
parent
c2b1b81b2b
commit
864c72f6ce
1 changed files with 61 additions and 54 deletions
|
@ -341,6 +341,7 @@ def handle_button_click(bot, update):
|
||||||
logger.debug("No game found for hash {}".format(bhash))
|
logger.debug("No game found for hash {}".format(bhash))
|
||||||
return
|
return
|
||||||
game.lock.acquire()
|
game.lock.acquire()
|
||||||
|
try:
|
||||||
if game.stopped:
|
if game.stopped:
|
||||||
return
|
return
|
||||||
board = game.board
|
board = game.board
|
||||||
|
@ -396,6 +397,12 @@ def handle_button_click(bot, update):
|
||||||
update_keyboard_request(bot, bhash, game, chat_id, msg.message_id)
|
update_keyboard_request(bot, bhash, game, chat_id, msg.message_id)
|
||||||
else:
|
else:
|
||||||
game.lock.release()
|
game.lock.release()
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
game.lock.release()
|
||||||
|
except RuntimeError:
|
||||||
|
pass
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue