From b7a24bb1ced1b218d092dcbecc3f934c78b37748 Mon Sep 17 00:00:00 2001 From: Casey Waldren Date: Tue, 10 Dec 2024 14:54:49 -0800 Subject: [PATCH] fix handling of UpdateStatus --- internal/datasystem/fdv2_datasystem.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/internal/datasystem/fdv2_datasystem.go b/internal/datasystem/fdv2_datasystem.go index cce86d88..6e3ed6ff 100644 --- a/internal/datasystem/fdv2_datasystem.go +++ b/internal/datasystem/fdv2_datasystem.go @@ -386,19 +386,17 @@ func (f *FDv2) Offline() bool { } //nolint:revive // DataSourceStatusReporter method. -func (f *FDv2) UpdateStatus(status interfaces.DataSourceState, err interfaces.DataSourceErrorInfo) { +func (f *FDv2) UpdateStatus(state interfaces.DataSourceState, err interfaces.DataSourceErrorInfo) { f.mu.Lock() defer f.mu.Unlock() - oldState := f.status.State - - f.status = interfaces.DataSourceStatus{ - State: status, - LastError: err, + if state != f.status.State { + f.status.State = state + f.status.StateSince = time.Now() } - if status != oldState { - f.status.StateSince = time.Now() + if err != f.status.LastError { + f.status.LastError = err } }