mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
fix: more server state read in command invocation (#2114)
fix: more server state read
This commit is contained in:
parent
169c9d3975
commit
146f46e77a
1 changed files with 3 additions and 1 deletions
|
@ -57,11 +57,13 @@ bool CommandId::IsTransactional() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandId::Invoke(CmdArgList args, ConnectionContext* cntx) const {
|
void CommandId::Invoke(CmdArgList args, ConnectionContext* cntx) const {
|
||||||
ServerState* ss = ServerState::tlocal();
|
|
||||||
int64_t before = absl::GetCurrentTimeNanos();
|
int64_t before = absl::GetCurrentTimeNanos();
|
||||||
handler_(args, cntx);
|
handler_(args, cntx);
|
||||||
int64_t after = absl::GetCurrentTimeNanos();
|
int64_t after = absl::GetCurrentTimeNanos();
|
||||||
|
|
||||||
|
ServerState* ss = ServerState::tlocal(); // Might have migrated thread, read after invocation
|
||||||
int64_t execution_time_micro_s = (after - before) / 1000;
|
int64_t execution_time_micro_s = (after - before) / 1000;
|
||||||
|
|
||||||
const auto* conn = cntx->conn();
|
const auto* conn = cntx->conn();
|
||||||
auto& ent = command_stats_[ss->thread_index()];
|
auto& ent = command_stats_[ss->thread_index()];
|
||||||
// TODO: we should probably discard more commands here,
|
// TODO: we should probably discard more commands here,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue