Skip to content

Commit

Permalink
feat: update dal
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed Aug 14, 2024
1 parent ebc6a30 commit 1f631cc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions node/pkg/dal/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ func (c *Collector) receive(ctx context.Context) {
go c.baseRediscribe.Start(ctx)

if c.subRediscribe != nil {
// wait for sidecar to be ready
time.Sleep(10 * time.Second)
go c.subRediscribe.Start(ctx)
}
}
Expand Down
10 changes: 10 additions & 0 deletions node/pkg/db/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"os"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -113,6 +114,15 @@ func isConnectionError(err error) bool {
if errors.Is(err, redis.Nil) {
return false
}

if errors.Is(err, redis.ErrClosed) {
return true
}

if strings.Contains(err.Error(), "i/o timeout") {
return true
}

return err == redis.TxFailedErr || err.Error() == "redis: connection closed"
}

Expand Down

0 comments on commit 1f631cc

Please sign in to comment.