[新增] 实现节点强制同步功能,允许通过 API 请求强制同步配置

This commit is contained in:
ryan
2026-05-29 10:37:23 +08:00
parent 32dc7ef68e
commit 944b98d4d0
2 changed files with 16 additions and 1 deletions
@@ -119,6 +119,22 @@ func (f *fakeSyncService) SyncOnce(ctx context.Context, target *protocol.ActiveC
return f.syncOnceErr
}
func (f *fakeSyncService) ForceSyncOnce(ctx context.Context, target *protocol.ActiveConfigMeta) error {
f.mu.Lock()
f.syncOnceCalls++
if target != nil {
copied := *target
f.lastTarget = &copied
}
callIndex := f.syncOnceCalls
callback := f.onSyncOnceCall
f.mu.Unlock()
if callback != nil {
callback(callIndex)
}
return f.syncOnceErr
}
type fakeWebSocketConnection struct {
pongCalls int
}