File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,11 @@ async def _process_scheduled_saves(self) -> None:
177177
178178 await self ._save_jupyter_ydoc ()
179179
180+ self .log .info (
181+ "Stopped `self._process_scheduled_save()` background task "
182+ f"for YRoom '{ self .room_id } '."
183+ )
184+
180185
181186 async def _save_jupyter_ydoc (self ):
182187 """
@@ -215,6 +220,10 @@ async def stop(self) -> None:
215220 Gracefully stops the YRoomFileAPI, saving the content of
216221 `self.jupyter_ydoc` before exiting.
217222 """
223+ # Stop the `self._process_scheduled_saves()` background task
224+ # immediately. This is safe since we save before stopping anyways.
225+ self ._scheduled_saves .shutdown (immediate = True )
226+
218227 # Do nothing if content was not loaded first. This prevents overwriting
219228 # the existing file with an empty JupyterYDoc.
220229 if not (self ._ydoc_content_loaded .is_set ()):
You can’t perform that action at this time.
0 commit comments