feat 加大缓存使用 && 订阅搜索休眠

This commit is contained in:
jxxghp
2023-10-21 08:17:10 +08:00
parent 15b1c756a7
commit cdbe5b2e2f
3 changed files with 11 additions and 3 deletions

View File

@ -1,5 +1,7 @@
import json
import random
import re
import time
from datetime import datetime
from typing import Dict, List, Optional, Union, Tuple
@ -162,6 +164,11 @@ class SubscribeChain(ChainBase):
if (now - subscribe_time).total_seconds() < 60:
logger.debug(f"订阅标题:{subscribe.name} 新增小于1分钟暂不搜索...")
continue
# 随机休眠1-5分钟
if not sid and state == 'R':
sleep_time = random.randint(60, 300)
logger.info(f'订阅搜索随机休眠 {sleep_time} 秒 ...')
time.sleep(sleep_time)
logger.info(f'开始搜索订阅,标题:{subscribe.name} ...')
# 如果状态为N则更新为R
if subscribe.state == 'N':