Skip to content

Commit

Permalink
Add ResetFailCount to subscriberAPI
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Ding <[email protected]>
  • Loading branch information
jzding committed Aug 22, 2024
1 parent 51aca34 commit a0b03bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/protocol/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ func (h *Server) SendTo(wg *sync.WaitGroup, clientID uuid.UUID, clientAddress, r
}
log.Errorf("connection lost addressing %s", clientAddress)
} else {
h.subscriberAPI.ResetFailCount(clientID)
localmetrics.UpdateEventCreatedCount(resourceAddress, localmetrics.SUCCESS, 1)
h.DataOut <- &channel.DataChan{
Address: resourceAddress,
Expand Down
7 changes: 7 additions & 0 deletions v1/subscriber/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,13 @@ func (p *API) IncFailCountToFail(clientID uuid.UUID) bool {
return false
}

// ResetFailCount ..reset fail count
func (p *API) ResetFailCount(clientID uuid.UUID) {
if subStore, ok := p.SubscriberStore.Get(clientID); ok {
subStore.ResetFailCount()
}
}

// FailCountThreshold .. get threshold
func (p *API) FailCountThreshold() int {
return subscriber.SetConnectionToFailAfter
Expand Down

0 comments on commit a0b03bc

Please sign in to comment.