@@ -3,7 +3,6 @@ package telemetry
33import (
44 "context"
55 "fmt"
6- "github.com/icinga/icinga-go-library/com"
76 "github.com/icinga/icinga-go-library/logging"
87 "github.com/icinga/icinga-go-library/periodic"
98 "github.com/icinga/icinga-go-library/redis"
@@ -81,7 +80,7 @@ func GetCurrentDbConnErr() (string, int64) {
8180var OngoingSyncStartMilli int64
8281
8382// LastSuccessfulSync is to be updated by the main() function.
84- var LastSuccessfulSync com. Atomic [SuccessfulSync ]
83+ var LastSuccessfulSync atomic. Pointer [SuccessfulSync ]
8584
8685var boolToStr = map [bool ]string {false : "0" , true : "1" }
8786var startTime = time .Now ().UnixMilli ()
@@ -101,7 +100,7 @@ func StartHeartbeat(
101100 heartbeat := heartbeat .LastReceived ()
102101 responsibleTsMilli , responsible , otherResponsible := ha .State ()
103102 ongoingSyncStart := atomic .LoadInt64 (& OngoingSyncStartMilli )
104- sync , _ := LastSuccessfulSync .Load ()
103+ lastSync := LastSuccessfulSync .Load ()
105104 dbConnErr , dbConnErrSinceMilli := GetCurrentDbConnErr ()
106105 now := time .Now ()
107106
@@ -117,8 +116,8 @@ func StartHeartbeat(
117116 "ha-responsible-ts" : strconv .FormatInt (responsibleTsMilli , 10 ),
118117 "ha-other-responsible" : boolToStr [otherResponsible ],
119118 "sync-ongoing-since" : strconv .FormatInt (ongoingSyncStart , 10 ),
120- "sync-success-finish" : strconv .FormatInt (sync .FinishMilli , 10 ),
121- "sync-success-duration" : strconv .FormatInt (sync .DurationMilli , 10 ),
119+ "sync-success-finish" : strconv .FormatInt (lastSync .FinishMilli , 10 ),
120+ "sync-success-duration" : strconv .FormatInt (lastSync .DurationMilli , 10 ),
122121 }
123122
124123 ctx , cancel := context .WithDeadline (ctx , tick .Time .Add (interval ))
0 commit comments