release the lock at the right time
This commit is contained in:
parent
9d3aa65154
commit
036550eb42
1 changed files with 5 additions and 2 deletions
|
@ -347,15 +347,18 @@ def handle_button_click(bot, update):
|
||||||
if board.state == 0:
|
if board.state == 0:
|
||||||
mmap = None
|
mmap = None
|
||||||
board.move((row, col))
|
board.move((row, col))
|
||||||
|
if board.state != 1:
|
||||||
|
game.stopped = True
|
||||||
game.lock.release()
|
game.lock.release()
|
||||||
game.save_action(user, (row, col))
|
game.save_action(user, (row, col))
|
||||||
update_keyboard_request(bot, bhash, game, chat_id, msg.message_id)
|
update_keyboard_request(bot, bhash, game, chat_id, msg.message_id)
|
||||||
else:
|
else:
|
||||||
mmap = deepcopy(board.map)
|
mmap = deepcopy(board.map)
|
||||||
board.move((row, col))
|
board.move((row, col))
|
||||||
game.lock.release()
|
|
||||||
if board.state != 1:
|
if board.state != 1:
|
||||||
game.stopped = True
|
game.stopped = True
|
||||||
|
game.lock.release()
|
||||||
|
|
||||||
# if this is the first move, there's no mmap
|
# if this is the first move, there's no mmap
|
||||||
if mmap is not None:
|
if mmap is not None:
|
||||||
game.save_action(user, (row, col))
|
game.save_action(user, (row, col))
|
||||||
|
|
Loading…
Reference in a new issue