Skip to content

Commit 3b7cbcc

Browse files
committed
fix: un-comment resource management
1 parent dec4789 commit 3b7cbcc

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

projects/jupyter-server-ydoc/jupyter_server_ydoc/websocketserver.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,17 @@ async def clean(self):
6363
# prevent hanging stop process - it also requires some thinking about
6464
# should the ystore write action be cancelled; I guess not as it could
6565
# results in corrupted data.
66-
# room_tasks = list()
67-
# for name, room in list(self.rooms.items()):
68-
# for task in room.background_tasks:
69-
# task.cancel() # FIXME should be upstreamed
70-
# room_tasks.append(task)
71-
# if room_tasks:
72-
# _, pending = await asyncio.wait(room_tasks, timeout=3)
73-
# if pending:
74-
# msg = f"{len(pending)} room task(s) are pending."
75-
# self.log.warning(msg)
76-
# self.log.debug("Pending tasks: %r", pending)
66+
room_tasks = list()
67+
for name, room in list(self.rooms.items()):
68+
for task in room.background_tasks:
69+
task.cancel() # FIXME should be upstreamed
70+
room_tasks.append(task)
71+
if room_tasks:
72+
_, pending = await asyncio.wait(room_tasks, timeout=3)
73+
if pending:
74+
msg = f"{len(pending)} room task(s) are pending."
75+
self.log.warning(msg)
76+
self.log.debug("Pending tasks: %r", pending)
7777

7878
await self.stop()
7979
tasks = []

0 commit comments

Comments
 (0)