]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fix: Avoid incorrect error log for Redis write in reshare mode
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 11 May 2022 18:30:26 +0000 (20:30 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 14 May 2022 18:41:29 +0000 (20:41 +0200)
src/storage/secondary/RedisStorage.cpp

index 2a5922fbae98c2c79ae1ff4f2dad00a1d0c1e892..288fe35faf73cb9d7b89fb5324cf17ca8db7338b 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2021 Joel Rosdahl and other contributors
+// Copyright (C) 2021-2022 Joel Rosdahl and other contributors
 //
 // See doc/AUTHORS.adoc for a complete list of contributors.
 //
@@ -180,11 +180,11 @@ RedisStorageBackend::put(const Digest& key,
     const auto reply = redis_command("EXISTS %s", key_string.c_str());
     if (!reply) {
       return nonstd::make_unexpected(reply.error());
-    } else if ((*reply)->type == REDIS_REPLY_INTEGER && (*reply)->integer > 0) {
+    } else if ((*reply)->type != REDIS_REPLY_INTEGER) {
+      LOG("Unknown reply type: {}", (*reply)->type);
+    } else if ((*reply)->integer > 0) {
       LOG("Entry {} already in Redis", key_string);
       return false;
-    } else {
-      LOG("Unknown reply type: {}", (*reply)->type);
     }
   }