From c9fe106606da59d16f0ab7749d0cc69ed042ff49 Mon Sep 17 00:00:00 2001 From: Nathan Yergler Date: Mon, 19 Jul 2021 14:13:18 -0700 Subject: [PATCH] Remove version check from Redis preflight This commit removes the `INFO` version check from the Redis connection preflighting. In our automated test suite we make extensive use of [`miniredis`](https://github.com/alicebob/miniredis) rather than depending on a full Redis server. Miniredis is quite capable, but does not implement the `INFO` command. Redis 5 was released in 2018 and was a significant upgrade to Redis. I haven't seen Redis < 5 in production since shortly after 5's release. Therefore I believe this to be a reasonable loosening of the constraints on redisqueue. --- redis.go | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/redis.go b/redis.go index 0a5a68c..d032c2d 100644 --- a/redis.go +++ b/redis.go @@ -30,25 +30,11 @@ func newRedisClient(options *RedisOptions) *redis.Client { // to the actual instance and that the instance supports Redis streams (i.e. // it's at least v5). func redisPreflightChecks(client redis.UniversalClient) error { - info, err := client.Info("server").Result() + _, err := client.Ping().Result() if err != nil { return err } - match := redisVersionRE.FindAllStringSubmatch(info, -1) - if len(match) < 1 { - return fmt.Errorf("could not extract redis version") - } - version := strings.TrimSpace(match[0][1]) - parts := strings.Split(version, ".") - major, err := strconv.Atoi(parts[0]) - if err != nil { - return err - } - if major < 5 { - return fmt.Errorf("redis streams are not supported in version %q", version) - } - return nil }