Skip to content

Commit

Permalink
fix handling of UpdateStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
cwaldren-ld committed Dec 10, 2024
1 parent 30740a6 commit b7a24bb
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions internal/datasystem/fdv2_datasystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down

0 comments on commit b7a24bb

Please sign in to comment.