Skip to content

Commit 326e4b2

Browse files
committed
chore: shutdown global __executor in atexit
1 parent 0fcdec1 commit 326e4b2

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"request": "launch",
2121
"module": "robotcode.cli",
2222
"justMyCode": false,
23-
//"cwd": "${workspaceFolder}/tests/robotcode/language_server/robotframework/parts/data/tests",
24-
"cwd": "C:\\develop\\robot\\robotframework",
23+
"cwd": "${workspaceFolder}/tests/robotcode/language_server/robotframework/parts/data/tests",
24+
//"cwd": "C:\\develop\\robot\\robotframework",
2525
// "env": {
2626
// "ROBOTCODE_COLOR": "1",
2727
// },

packages/core/src/robotcode/core/async_tools.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import asyncio
4+
import atexit
45
import concurrent.futures
56
import contextvars
67
import functools
@@ -268,6 +269,13 @@ def check_canceled_sync() -> bool:
268269
__executor = ThreadPoolExecutor(thread_name_prefix="global_sub_asyncio")
269270

270271

272+
def shutdown_thread_pool_executor() -> None:
273+
__executor.shutdown(wait=False)
274+
275+
276+
atexit.register(shutdown_thread_pool_executor)
277+
278+
271279
def run_in_thread(func: Callable[..., _T], /, *args: Any, **kwargs: Any) -> asyncio.Future[_T]:
272280
loop = asyncio.get_running_loop()
273281

0 commit comments

Comments
 (0)