mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-09-10 23:25:42 +08:00
Merge pull request #293 from buthed010203/patch-1
Potential fix for windows crashing on RemoveOrphaned
This commit is contained in:
commit
42f8d65965
1 changed files with 6 additions and 4 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue