mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
fix(server): Fix async lua (#1982)
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
This commit is contained in:
parent
d16195bfb7
commit
1ea0c39d6a
5 changed files with 29 additions and 6 deletions
|
@ -1331,6 +1331,8 @@ optional<CapturingReplyBuilder::Payload> Service::FlushEvalAsyncCmds(ConnectionC
|
|||
if ((info->async_cmds.empty() || !force) && used_mem < info->async_cmds_heap_limit)
|
||||
return nullopt;
|
||||
|
||||
++ServerState::tlocal()->stats.eval_squashed_flushes;
|
||||
|
||||
auto* eval_cid = registry_.Find("EVAL");
|
||||
DCHECK(eval_cid);
|
||||
cntx->transaction->MultiSwitchCmd(eval_cid);
|
||||
|
@ -1629,19 +1631,20 @@ void Service::EvalInternal(CmdArgList args, const EvalArgs& eval_args, Interpret
|
|||
++ServerState::tlocal()->stats.eval_io_coordination_cnt;
|
||||
interpreter->SetRedisFunc(
|
||||
[cntx, this](Interpreter::CallArgs args) { CallFromScript(cntx, args); });
|
||||
|
||||
result = interpreter->RunFunction(eval_args.sha, &error);
|
||||
|
||||
if (auto err = FlushEvalAsyncCmds(cntx, true); err) {
|
||||
auto err_ref = CapturingReplyBuilder::GetError(*err);
|
||||
result = Interpreter::RUN_ERR;
|
||||
error = absl::StrCat(err_ref->first);
|
||||
}
|
||||
|
||||
// Conclude the transaction.
|
||||
if (*scheduled)
|
||||
cntx->transaction->UnlockMulti();
|
||||
}
|
||||
|
||||
if (auto err = FlushEvalAsyncCmds(cntx, true); err) {
|
||||
auto err_ref = CapturingReplyBuilder::GetError(*err);
|
||||
result = Interpreter::RUN_ERR;
|
||||
error = absl::StrCat(err_ref->first);
|
||||
}
|
||||
|
||||
cntx->conn_state.script_info.reset(); // reset script_info
|
||||
|
||||
if (result == Interpreter::RUN_ERR) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue