fix(reliability): 采集器并发去重 + 备份恢复即时重载 + context 贯穿请求链
- CollectorService 安装/卸载按采集器互斥去重(重复触发不再并发 docker rm/run 互踩);删除后卸载失败留日志 - ApplyStagedBackup 替换文件后立即 Reload 内存态,消除「重启前旧内存落盘覆盖恢复文件」竞态;暂存文件名升级 lokistack.json(兼容旧名) - GetUsage/Validate 全链路 context 贯穿:请求取消即中止 SSH/k8s 查询(异步调用点显式 Background)
This commit is contained in:
1 parent
9daaf7f403
commit
572efc89a4
9 files changed
+180
-29
No files matched your search
@@ -107,7 +107,7 @@ func (s *ClusterService) Create(name, description, configType, apiServer, kubeco
|
||||
db.Unlock()
|
||||
db.RequestSave()
|
||||
|
||||
go s.Validate(cluster.ID)
|
||||
go s.Validate(context.Background(), cluster.ID)
|
||||
return &cluster, nil
|
||||
}
|
||||
|
||||
@@ -222,12 +222,12 @@ func (s *ClusterService) Delete(id uint) error {
|
||||
return utils.ErrNotFound
|
||||
}
|
||||
|
||||
func (s *ClusterService) Validate(id uint) {
|
||||
func (s *ClusterService) Validate(ctx context.Context, id uint) {
|
||||
cluster, err := s.Get(id)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
|
||||
defer cancel()
|
||||
|
||||
info, err := GetClusterInfo(ctx, cluster)
|
||||
|
||||
Reference in new issue
Block a user