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))
|
||||
return
|
||||
game.lock.acquire()
|
||||
try:
|
||||
if game.stopped:
|
||||
return
|
||||
board = game.board
|
||||
|
@ -396,6 +397,12 @@ def handle_button_click(bot, update):
|
|||
update_keyboard_request(bot, bhash, game, chat_id, msg.message_id)
|
||||
else:
|
||||
game.lock.release()
|
||||
except:
|
||||
try:
|
||||
game.lock.release()
|
||||
except RuntimeError:
|
||||
pass
|
||||
raise
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue