From fbe788d63298d871261f3e3472cd02d0d0332ffe Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Sat, 16 Sep 2023 22:18:52 +0200 Subject: [PATCH] v2.3.9 Signed-off-by: Jeroen Oudshoorn --- pwnagotchi/plugins/__init__.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pwnagotchi/plugins/__init__.py b/pwnagotchi/plugins/__init__.py index f6104a2e..53ee9342 100644 --- a/pwnagotchi/plugins/__init__.py +++ b/pwnagotchi/plugins/__init__.py @@ -1,19 +1,17 @@ import os import glob +import _thread import threading -import importlib -import importlib.util +import importlib, importlib.util import logging -from concurrent.futures import ThreadPoolExecutor + + default_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "default") loaded = {} database = {} locks = {} -THREAD_POOL_SIZE = 10 -executor = ThreadPoolExecutor(max_workers=THREAD_POOL_SIZE) - class Plugin: @classmethod @@ -98,7 +96,7 @@ def one(plugin_name, event_name, *args, **kwargs): try: lock_name = "%s::%s" % (plugin_name, cb_name) locked_cb_args = (lock_name, callback, *args, *kwargs) - executor.submit(locked_cb, *locked_cb_args) + _thread.start_new_thread(locked_cb, locked_cb_args) except Exception as e: logging.error("error while running %s.%s : %s" % (plugin_name, cb_name, e)) logging.error(e, exc_info=True)