Skip to content

Commit 534b439

Browse files
committed
Use the recommended async with syntax to acquire and release an asyncio Lock.
See https://docs.python.org/3/library/asyncio-sync.html#asyncio.Lock I think this also works in Python 3.5: https://docs.python.org/3/whatsnew/3.5.html#pep-492-coroutines-with-async-and-await-syntax
1 parent 87a3550 commit 534b439

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

jupyter_server_proxy/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ async def ensure_process(self):
491491
# FIXME: Make sure this times out properly?
492492
# Invariant here should be: when lock isn't being held, either 'proc' is in state &
493493
# running, or not.
494-
with (await self.state['proc_lock']):
494+
async with self.state['proc_lock']:
495495
if 'proc' not in self.state:
496496
# FIXME: Prevent races here
497497
# FIXME: Handle graceful exits of spawned processes here

0 commit comments

Comments
 (0)