Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
redis.Client#XReadUntilResult(): also re-try timeout errors
We need to retry the XREAD commands in the following situations: - If Go Redis returns redis.Nil, it means no data was read from Redis — e.g. when the keys don’t exist yet, and we will need to retry the operation again. - To prevent surpassing Go Redis's internal maximum retries or any other I/O timeouts [^1], it's important to set a block timeout greater than zero for the XREAD commands, see the `a.Block` assignment. However, setting a block timeout means that Go Redis will not retry any errors internally and will instead return an I/O timeout error when exceeding the timeout. Thus, we need to handle this here and retry it again. On the other hand, an I/O timeout could also mean a `context.DeadlineExceeded` error, which is not retryable, so we have to check for context termination by ourselves via `ctx.Err()`. [^1]: redis/go-redis#2131
- Loading branch information