diff --git a/database/redis/notification.go b/database/redis/notification.go index ebb74f616..f7a343f72 100644 --- a/database/redis/notification.go +++ b/database/redis/notification.go @@ -317,6 +317,9 @@ func getNotificationsInTxWithLimit(ctx context.Context, tx *redis.Tx, to int64, response := tx.ZRangeByScore(ctx, notifierNotificationsKey, rng) if response.Err() != nil { + if errors.Is(response.Err(), redis.TxFailedErr) { + return nil, &transactionError{} + } return nil, fmt.Errorf("failed to ZRANGEBYSCORE: %w", response.Err()) } @@ -379,9 +382,6 @@ func (connector *DbConnector) fetchNotificationsDo(to int64, limit *int64) ([]*m err := c.Watch(ctx, func(tx *redis.Tx) error { notifications, err := getNotificationsInTxWithLimit(ctx, tx, to, limit) if err != nil { - if errors.Is(err, redis.TxFailedErr) { - return &transactionError{} - } return fmt.Errorf("failed to get notifications with limit in transaction: %w", err) }