Skip to content

Commit 88eb32c

Browse files
committed
maybe
1 parent 66458cf commit 88eb32c

File tree

1 file changed

+10
-5
lines changed
  • services/director-v2/src/simcore_service_director_v2/modules/comp_scheduler

1 file changed

+10
-5
lines changed

services/director-v2/src/simcore_service_director_v2/modules/comp_scheduler/_scheduler_base.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"""
1313

1414
import asyncio
15+
import concurrent
16+
import concurrent.futures
1517
import datetime
1618
import logging
1719
from abc import ABC, abstractmethod
@@ -78,6 +80,7 @@
7880

7981

8082
def _auto_schedule_callback(
83+
loop: asyncio.AbstractEventLoop,
8184
db_engine: Engine,
8285
rabbit_mq_client: RabbitMQClient,
8386
*,
@@ -95,11 +98,13 @@ async def _async_cb():
9598
iteration=iteration,
9699
)
97100

98-
future = asyncio.run_coroutine_threadsafe(
99-
_async_cb(), asyncio.get_running_loop()
100-
)
101-
with log_catch(_logger, reraise=False):
102-
future.result(timeout=10)
101+
future = asyncio.run_coroutine_threadsafe(_async_cb(), loop)
102+
103+
def handle_future_result(fut: concurrent.futures.Future) -> None:
104+
with log_catch(_logger, reraise=False):
105+
fut.result(timeout=10)
106+
107+
future.add_done_callback(handle_future_result)
103108

104109
return _cb
105110

0 commit comments

Comments
 (0)