diff --git a/src/commands/cmd_txn.cc b/src/commands/cmd_txn.cc index 3138c364702..b6c94c06a67 100644 --- a/src/commands/cmd_txn.cc +++ b/src/commands/cmd_txn.cc @@ -98,6 +98,12 @@ class CommandWatch : public Commander { return {Status::RedisExecErr, "WATCH inside MULTI is not allowed"}; } + // If a conn is already marked as watched_keys_modified, we can skip the watch. + if (svr->IsWatchedKeysModified(conn)) { + *output = redis::SimpleString("OK"); + return Status::OK(); + } + svr->WatchKey(conn, std::vector(args_.begin() + 1, args_.end())); *output = redis::SimpleString("OK"); return Status::OK();