diff --git a/src/webqueue2api/parser/queue.py b/src/webqueue2api/parser/queue.py index 02a6d90..22b96be 100644 --- a/src/webqueue2api/parser/queue.py +++ b/src/webqueue2api/parser/queue.py @@ -1,4 +1,5 @@ import multiprocessing +import multiprocessing.pool import os, re from pathlib import Path from .item import Item @@ -198,6 +199,20 @@ def load_queues(*queues, headers_only: bool = True) -> list: Returns: list: A list of all the queues that were given as arguments, or all of the queues if no queues were specified """ + # custom class creation based on stackoverflow answer + class NoDaemonProcess(multiprocessing.Process): + # make 'daemon' attribute always return False + def _get_daemon(self): + return False + def _set_daemon(self, value): + pass + daemon = property(_get_daemon, _set_daemon) + + # We sub-class multiprocessing.pool.Pool instead of multiprocessing.Pool + # because the latter is only a wrapper function, not a proper class. + class MyPool(multiprocessing.pool.Pool): + Process = NoDaemonProcess + queues = [] for queue in get_valid_queues():