Merge pull request #293 from buthed010203/patch-1

Potential fix for windows crashing on RemoveOrphaned
This commit is contained in:
bobokun 2023-05-20 12:10:34 -04:00 committed by GitHub
commit 42f8d65965
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,7 +7,6 @@ from multiprocessing import Pool
from modules import util
logger = util.logger
_config = None
class RemoveOrphaned:
@ -21,9 +20,7 @@ class RemoveOrphaned:
self.root_dir = qbit_manager.config.root_dir
self.orphaned_dir = qbit_manager.config.orphaned_dir
global _config
_config = self.config
self.pool = Pool(processes=max(cpu_count() - 1, 1))
self.pool = Pool(processes=max(cpu_count() - 1, 1), initializer=init_pool, initargs=(self.config,))
self.rem_orphaned()
self.cleanup_pool()
@ -106,6 +103,11 @@ class RemoveOrphaned:
self.pool.join()
def init_pool(conf):
global _config
_config = conf
def get_full_path_of_torrent_files(torrent_files, save_path):
fullpath_torrent_files = []
for file in torrent_files: