Skip to content

Commit

Permalink
Check shutdown error on resend (#135)
Browse files Browse the repository at this point in the history
* fix: Check shutdown error on resend

* feat: Handle general shutdown errors while resending
  • Loading branch information
Hyodar authored May 1, 2024
1 parent c285cff commit 7700233
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions operator/rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,21 @@ func (c *AggregatorRpcClient) tryResendFromDeque() {
if err != nil {
c.logger.Error("Couldn't resend message", "err", err)

if i == 0 {
c.logger.Error("Couldn't resend first message, most likely a connection error")
return
if err == rpc.ErrShutdown {
c.logger.Error("Couldn't resend message due to shutdown")

if errorPos == 0 {
c.unsentMessages = c.unsentMessages[i:]
return
}

for j := i; j < len(c.unsentMessages); j++ {
message := c.unsentMessages[j]
c.unsentMessages[errorPos] = message
errorPos++
}

break
}

c.unsentMessages[errorPos] = message
Expand Down

0 comments on commit 7700233

Please sign in to comment.