From 67b75a951cc600fe0cbd6d555e1cf35c829f29de Mon Sep 17 00:00:00 2001 From: morimoto-cybozu Date: Wed, 26 Jul 2023 12:18:49 +0000 Subject: [PATCH] Fix to check error of watch response Signed-off-by: morimoto-cybozu --- agent/agent.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/agent/agent.go b/agent/agent.go index 8e0c11d..260b2dc 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -37,6 +37,10 @@ func (a *Agent) StartWatching(ctx context.Context, updateCh chan<- struct{}) err clientv3.WithProgressNotify(), ) for wresp := range rch { + if err := wresp.Err(); err != nil { + return err + } + atomic.StoreInt64(&a.rev, wresp.Header.Revision) // notify updater if possible