Skip to content

Commit

Permalink
fix: add count msg for websocket delay
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed Aug 28, 2024
1 parent 52f309f commit c102cde
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions node/pkg/checker/dal/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ func extractWsDelayAlarms(ctx context.Context, alarmCount map[string]int) []stri
return nil
}

delayedSymbolCount := 0
delayedSymbols := map[string]any{}
resultMsgs := []string{}
for _, entry := range rawMsgs {
Expand All @@ -240,9 +241,15 @@ func extractWsDelayAlarms(ctx context.Context, alarmCount map[string]int) []stri
if alarmCount[symbol] > AlarmOffsetPerPair {
resultMsgs = append(resultMsgs, entry)
alarmCount[symbol] = 0
} else if alarmCount[symbol] > AlarmOffsetInTotal {
delayedSymbolCount++
}
}

if delayedSymbolCount > 0 {
resultMsgs = append(resultMsgs, fmt.Sprintf("Websocket delayed for %d symbols", delayedSymbolCount))
}

for symbol := range alarmCount {
if _, exists := delayedSymbols[symbol]; !exists {
alarmCount[symbol] = 0
Expand Down

0 comments on commit c102cde

Please sign in to comment.