From 3ae136816e661f885cb62f25854862a9aca96a39 Mon Sep 17 00:00:00 2001 From: Carlos Herrero <26092748+hbcarlos@users.noreply.github.com> Date: Fri, 13 Oct 2023 00:39:50 +0200 Subject: [PATCH] CI --- jupyter_collaboration/app.py | 12 ++++++++++-- jupyter_collaboration/stores/utils.py | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/jupyter_collaboration/app.py b/jupyter_collaboration/app.py index 22378b77..4eacdc79 100644 --- a/jupyter_collaboration/app.py +++ b/jupyter_collaboration/app.py @@ -85,8 +85,16 @@ def initialize_handlers(self): # We are temporarily initializing the store here because the # initialization is async self.store = self.ystore_class(log=self.log) - loop = asyncio.get_event_loop() - loop.run_until_complete(self.store.initialize()) + + try: + loop = asyncio.get_event_loop() + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + + task = loop.create_task(self.store.initialize()) + if not loop.is_running(): + loop.run_until_complete(task) # self.settings is local to the ExtensionApp but here we need # the global app settings in which the file id manager will register diff --git a/jupyter_collaboration/stores/utils.py b/jupyter_collaboration/stores/utils.py index 79f6b7f3..6e8d71e4 100644 --- a/jupyter_collaboration/stores/utils.py +++ b/jupyter_collaboration/stores/utils.py @@ -1,6 +1,7 @@ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. + class YDocNotFound(Exception): pass