fix server: fix write to slowlog on squashing flow (#4138)

Signed-off-by: adi_holden <adi@dragonflydb.io>
This commit is contained in:
adiholden 2024-11-17 16:03:30 +02:00 committed by GitHub
parent 8bd2b9ed3e
commit 59c81fb98a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1358,6 +1358,10 @@ bool Service::InvokeCmd(const CommandId* cid, CmdArgList tail_args, SinkReplyBui
// TODO: we should probably discard more commands here,
// not just the blocking ones
const auto* conn = cntx->conn();
if (cntx->conn_state.squashing_info) {
conn = cntx->conn_state.squashing_info->owner->conn();
}
if (!(cid->opt_mask() & CO::BLOCKING) && conn != nullptr &&
// Use SafeTLocal() to avoid accessing the wrong thread local instance
ServerState::SafeTLocal()->ShouldLogSlowCmd(invoke_time_usec)) {