Merge branch 'async_commands' of https://gitlab.eqalpha.com/keydb-dev/KeyDB-Pro into async_commands

Former-commit-id: d6cc79a80d0bd22c99e3ea21740c89870cfb235b
This commit is contained in:
malavan 2021-09-21 22:00:33 +00:00
commit 14914df0c8

View File

@ -2576,6 +2576,8 @@ bool FAsyncCommand(parsed_command &cmd)
if (serverTL->in_eval || serverTL->in_exec) if (serverTL->in_eval || serverTL->in_exec)
return false; return false;
auto parsedcmd = lookupCommand(szFromObj(cmd.argv[0])); auto parsedcmd = lookupCommand(szFromObj(cmd.argv[0]));
if (parsedcmd == nullptr)
return false;
static const long long expectedFlags = CMD_ASYNC_OK | CMD_READONLY; static const long long expectedFlags = CMD_ASYNC_OK | CMD_READONLY;
return (parsedcmd->flags & expectedFlags) == expectedFlags; return (parsedcmd->flags & expectedFlags) == expectedFlags;
} }
@ -2710,7 +2712,7 @@ void readQueryFromClient(connection *conn) {
if (cserver.cthreads > 1) { if (cserver.cthreads > 1) {
parseClientCommandBuffer(c); parseClientCommandBuffer(c);
if (g_pserver->enable_async_commands) if (g_pserver->enable_async_commands && (aeLockContention() || g_fTestMode))
processInputBuffer(c, false, CMD_CALL_SLOWLOG | CMD_CALL_STATS | CMD_CALL_ASYNC); processInputBuffer(c, false, CMD_CALL_SLOWLOG | CMD_CALL_STATS | CMD_CALL_ASYNC);
if (!c->vecqueuedcmd.empty()) if (!c->vecqueuedcmd.empty())
serverTL->vecclientsProcess.push_back(c); serverTL->vecclientsProcess.push_back(c);