refactor(config): retire RuntimeSettingsCompat host usage

This commit is contained in:
jxxghp
2026-08-26 15:55:21 +08:00
parent cdab54254d
commit 9dbe424c3d
162 changed files with 1966 additions and 1745 deletions
+4 -4
View File
@@ -39,9 +39,9 @@ class TransferDispatcher:
:param cache: 去重缓存,默认使用 10 秒 TTL 缓存
"""
self.all_exts = all_exts if all_exts is not None else (
get_runtime_setting("RMT_MEDIAEXT")
+ get_runtime_setting("RMT_SUBEXT")
+ get_runtime_setting("RMT_AUDIOEXT")
get_runtime_setting('RMT_MEDIAEXT')
+ get_runtime_setting('RMT_SUBEXT')
+ get_runtime_setting('RMT_AUDIOEXT')
)
self._cache = cache if cache is not None else TTLCache(region="monitor", maxsize=1024, ttl=10)
self._lock = Lock()
@@ -79,7 +79,7 @@ class TransferDispatcher:
"""
判断监控事件路径是否需要进入整理链。
"""
if self._has_suffix_in(file_path, get_runtime_setting("DOWNLOAD_TMPEXT")):
if self._has_suffix_in(file_path, get_runtime_setting('DOWNLOAD_TMPEXT')):
return False
return self._has_suffix_in(file_path, self.all_exts)
+2 -2
View File
@@ -235,7 +235,7 @@ class Monitor(ConfigReloadMixin, metaclass=SingletonClass):
# 启动定时服务进程
if not self.__accepting_work():
return False
self._scheduler = BackgroundScheduler(timezone=get_runtime_setting("TZ"))
self._scheduler = BackgroundScheduler(timezone=get_runtime_setting('TZ'))
mon_storages: Dict[str, List[Path]] = {}
# 本地监控启动结果计数,用于输出真实的启动总结
@@ -400,7 +400,7 @@ class Monitor(ConfigReloadMixin, metaclass=SingletonClass):
# 网络/FUSE 挂载轮询降频,减少监控自身对挂载后端的持续 stat 压力
poll_delay_ms = None
if use_polling and SystemUtils.is_network_filesystem(mon_path):
poll_delay_ms = (get_runtime_setting("MONITOR_POLL_DELAY_NETWORK")
poll_delay_ms = (get_runtime_setting('MONITOR_POLL_DELAY_NETWORK')
or LocalDirectoryWatcher.POLL_DELAY_NETWORK_MS)
logger.info(f"检测到网络文件系统,轮询扫描间隔调整为 {poll_delay_ms}ms: {mon_path}")
+1 -1
View File
@@ -19,7 +19,7 @@ class SnapshotStore:
:param cache: 快照文件缓存,默认使用 CACHE_PATH/snapshots
"""
self._cache = cache if cache is not None else FileCache(
base=get_runtime_setting("CACHE_PATH") / "snapshots"
base=get_runtime_setting('CACHE_PATH') / "snapshots"
)
def save(self, storage: str, snapshot: Dict, file_count: int = 0,
+1 -1
View File
@@ -123,7 +123,7 @@ def decide_monitor_mode(directory: Path,
# 检查网络文件系统
if SystemUtils.is_network_filesystem(directory):
if not get_runtime_setting("MONITOR_NETWORK_FAST_MODE"):
if not get_runtime_setting('MONITOR_NETWORK_FAST_MODE'):
return True, "检测到网络文件系统,建议使用兼容模式", None, None
# 用户已确认该挂载支持 inotify,继续走快速模式的系统限制检查
logger.info(f"检测到网络文件系统,但已配置允许快速模式: {directory}")
+1 -1
View File
@@ -286,7 +286,7 @@ class LocalDirectoryWatcher:
:return: 重扫轮次延迟秒数元组
"""
return self._parse_rescan_delays(
get_runtime_setting("MONITOR_RESCAN_DELAYS")
get_runtime_setting('MONITOR_RESCAN_DELAYS')
)
@classmethod