mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-07 00:16:57 +08:00
fix 中入队列等待时间,以例聚合消息发送
This commit is contained in:
+10
-3
@@ -5,6 +5,7 @@ import traceback
|
|||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
|
from time import sleep
|
||||||
from typing import List, Optional, Tuple, Union, Dict, Callable
|
from typing import List, Optional, Tuple, Union, Dict, Callable
|
||||||
|
|
||||||
from app import schemas
|
from app import schemas
|
||||||
@@ -363,8 +364,11 @@ class TransferChain(ChainBase, metaclass=Singleton):
|
|||||||
# 文件整理线程
|
# 文件整理线程
|
||||||
_transfer_thread = None
|
_transfer_thread = None
|
||||||
|
|
||||||
# 文件整理检查间隔(秒)
|
# 队列等待时间(秒)
|
||||||
_transfer_interval = 15
|
_queue_timeout = 5
|
||||||
|
|
||||||
|
# 队列间隔时间(秒)
|
||||||
|
_transfer_interval = 10
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@@ -532,7 +536,7 @@ class TransferChain(ChainBase, metaclass=Singleton):
|
|||||||
|
|
||||||
while not global_vars.is_system_stopped:
|
while not global_vars.is_system_stopped:
|
||||||
try:
|
try:
|
||||||
item: TransferQueue = self._queue.get(timeout=self._transfer_interval)
|
item: TransferQueue = self._queue.get(timeout=self._queue_timeout)
|
||||||
if item:
|
if item:
|
||||||
task = item.task
|
task = item.task
|
||||||
if not task:
|
if not task:
|
||||||
@@ -593,6 +597,9 @@ class TransferChain(ChainBase, metaclass=Singleton):
|
|||||||
fail_num = 0
|
fail_num = 0
|
||||||
# 标记为新队列
|
# 标记为新队列
|
||||||
__queue_start = True
|
__queue_start = True
|
||||||
|
|
||||||
|
# 等待一定时间,以让其他任务加入队列
|
||||||
|
sleep(self._transfer_interval)
|
||||||
continue
|
continue
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"整理队列处理出现错误:{e} - {traceback.format_exc()}")
|
logger.error(f"整理队列处理出现错误:{e} - {traceback.format_exc()}")
|
||||||
|
|||||||
Reference in New Issue
Block a user