mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-30 10:10:44 +02:00
Correctly check error on redis command XTRIM (#2518)
Also: - add comment about version requirement - move minID to var for code readability
This commit is contained in:
parent
65a2e4ed02
commit
87c96bc4d0
@ -71,7 +71,9 @@ func (r *redisStream) cleanupConsumers() error {
|
||||
}
|
||||
}
|
||||
|
||||
if err := r.redisClient.XTrimMinID(ctx, streamName, strconv.FormatInt(time.Now().Add(-d).Unix()*1000, 10)); err != nil {
|
||||
// `XTRIM MINID` requires Redis 6.2
|
||||
minID := strconv.FormatInt(time.Now().Add(-d).Unix()*1000, 10)
|
||||
if err := r.redisClient.XTrimMinID(ctx, streamName, minID).Err(); err != nil {
|
||||
logger.Errorf("Error trimming %s", err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user