fix:优化pm2配置项

This commit is contained in:
Daniel
2026-03-05 19:53:05 +08:00
parent 004b03b374
commit 98d928f457
10 changed files with 125 additions and 10 deletions

View File

@@ -3,6 +3,7 @@
import re
import socket
from datetime import datetime, timezone
from typing import List, Set, Tuple
import feedparser
@@ -33,7 +34,7 @@ def _matches_keywords(text: str) -> bool:
return False
def _fetch_one_feed(name: str, url: str, timeout: int) -> list[dict]:
def _fetch_one_feed(name: str, url: str, timeout: int) -> List[dict]:
"""抓取单个 RSS 源,超时或异常返回空列表。不负责去重。"""
old_timeout = socket.getdefaulttimeout()
socket.setdefaulttimeout(timeout)
@@ -72,14 +73,14 @@ def _fetch_one_feed(name: str, url: str, timeout: int) -> list[dict]:
return out
def fetch_all() -> list[dict]:
def fetch_all() -> List[dict]:
"""抓取所有配置的 RSS 源,按源超时与隔离错误,全局去重后返回。"""
sources = get_feed_sources()
if not sources:
return []
items: list[dict] = []
seen: set[tuple[str, str]] = set()
items: List[dict] = []
seen: Set[Tuple[str, str]] = set()
for name, url in sources:
batch = _fetch_one_feed(name, url, FEED_TIMEOUT)