feat: HH-773 合集重命名接入 egress geo 缓存、geo 失败降级与每小时补探测
Build and Publish Docker Image / build-and-push (pull_request) Successful in 15m54s
Build and Publish Docker Image / build-and-push (pull_request) Successful in 15m54s
- service: EgressCacheKey 从 handler 下沉复用;MergeCachedEgressGeo 在合集 重命名前合并缓存 geo 字段(纯缓存读、零网络 I/O);StripEgressGeoFields 防止 geo 字段泄漏进订阅输出 - filter: geo 检测失败的节点保留 '[别名] 原名'(或纯原名)参与编号/排序, 不再丢弃 - handler: 每小时 StartEgressRefresher 对启用源补探测缺失/过期的 egress 缓存(含 TTL 内 error 结果一律跳过);RegisterRoutes 返回 *Deps; cmd/server.go 启动定时任务并在 shutdown 时取消 - tests: service 缓存 key 稳定性/合并/管道测试、handler 补探测跳过/TTL/ 过期/取消测试、filter 降级测试;修复 2 个过时测试(mihomo YAML 配置、 缓存命中路径)
This commit is contained in:
+8
-1
@@ -122,7 +122,13 @@ func startFiber(cfg *config.Config, db *sqlx.DB) error {
|
||||
app.Use(middleware.DownloadHostIsolation(cfg.Auth.DownloadHosts))
|
||||
|
||||
// Register routes
|
||||
handler.RegisterRoutes(app, cfg, db)
|
||||
deps := handler.RegisterRoutes(app, cfg, db)
|
||||
|
||||
// Start egress geo refresher — HH-773: hourly low-frequency background
|
||||
// re-probe of nodes with missing/expired egress cache entries.
|
||||
egressCtx, egressCancel := context.WithCancel(context.Background())
|
||||
defer egressCancel()
|
||||
handler.StartEgressRefresher(egressCtx, deps, time.Hour)
|
||||
|
||||
// Health check
|
||||
app.Get("/health", func(c fiber.Ctx) error {
|
||||
@@ -154,6 +160,7 @@ func startFiber(cfg *config.Config, db *sqlx.DB) error {
|
||||
|
||||
logrus.Info("Shutting down server...")
|
||||
cacheCancel()
|
||||
egressCancel()
|
||||
|
||||
shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer shutdownCancel()
|
||||
|
||||
Reference in New Issue
Block a user