diff --git a/src/db.cpp b/src/db.cpp index 357559a38..509673cbe 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -1184,7 +1184,7 @@ void scanGenericCommand(client *c, robj_roptr o, unsigned long cursor) { { // Do an async version if (c->asyncCommand( - [c, keys, pat, type, cursor, count, use_pattern] (const redisDbPersistentDataSnapshot *snapshot, std::vector) { + [c, keys, pat, type, cursor, count, use_pattern] (const redisDbPersistentDataSnapshot *snapshot, const std::vector &) { sds patCopy = pat ? sdsdup(pat) : nullptr; sds typeCopy = type ? sdsdup(type) : nullptr; auto cursorResult = snapshot->scan_threadsafe(cursor, count, typeCopy, keys); diff --git a/src/server.cpp b/src/server.cpp index 573fdcb3e..a039b2863 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4952,15 +4952,15 @@ bool client::postFunction(std::function fn, bool fLock) { }, fLock) == AE_OK; } -std::vector client::args() { +std::vector clientArgs(client *c) { std::vector args; - for (int j = 1; j < this->argc; j++) { - args.push_back(robj_sharedptr(argv[j])); + for (int j = 1; j < c->argc; j++) { + args.push_back(robj_sharedptr(c->argv[j])); } return args; } -bool client::asyncCommand(std::function)> &&mainFn, +bool client::asyncCommand(std::function &)> &&mainFn, std::function &&postFn) { serverAssert(FCorrectThread(this)); @@ -4973,7 +4973,7 @@ bool client::asyncCommand(std::functionel; blockClient(this, BLOCKED_ASYNC); g_pserver->asyncworkqueue->AddWorkFunction([el, this, mainFn, postFn, snapshot] { - std::vector args = this->args(); + std::vector args = clientArgs(this); aePostFunction(el, [this, mainFn, postFn, snapshot, args] { aeReleaseLock(); std::unique_locklock)> lock(this->lock); diff --git a/src/server.h b/src/server.h index 101ca34eb..4b1a84bf1 100644 --- a/src/server.h +++ b/src/server.h @@ -1661,8 +1661,7 @@ struct client { // post a function from a non-client thread to run on its client thread bool postFunction(std::function fn, bool fLock = true); size_t argv_len_sum() const; - std::vector args(); - bool asyncCommand(std::function)> &&mainFn, + bool asyncCommand(std::function &)> &&mainFn, std::function &&postFn = nullptr); }; diff --git a/src/t_string.cpp b/src/t_string.cpp index 0e555351e..a09cfd919 100644 --- a/src/t_string.cpp +++ b/src/t_string.cpp @@ -544,7 +544,7 @@ void mgetCommand(client *c) { // Do async version for large number of arguments if (c->argc > 100) { if (c->asyncCommand( - [c] (const redisDbPersistentDataSnapshot *snapshot, std::vector keys) { + [c] (const redisDbPersistentDataSnapshot *snapshot, const std::vector &keys) { mgetCore(c, (robj **)keys.data(), keys.size(), snapshot); } )) {