needs to be a global variable, of course
This commit is contained in:
parent
7ea63ce623
commit
0321296014
@ -4,6 +4,11 @@ from wiz_game import the_game
|
||||
from starlette.websockets import WebSocketDisconnect
|
||||
import asyncio
|
||||
|
||||
|
||||
playing_lock = asyncio.Lock()
|
||||
|
||||
|
||||
|
||||
@api.route("/player/{player}")
|
||||
def show(req, resp, player: str):
|
||||
p = int(player)
|
||||
@ -31,11 +36,11 @@ def show(req, resp, player: str):
|
||||
|
||||
@api.route("/player/{player}/play/{card}")
|
||||
async def play(req, resp, player: str, card: str):
|
||||
lock = asyncio.Lock()
|
||||
p = int(player)
|
||||
c = int(card)
|
||||
|
||||
async with lock:
|
||||
global playing_lock
|
||||
async with playing_lock:
|
||||
try:
|
||||
isActive = the_game.players_ordered[the_game.active_player].id == p
|
||||
except IndexError:
|
||||
|
Loading…
Reference in New Issue
Block a user