diff --git a/BedrockCore.cpp b/BedrockCore.cpp index c37715d2b..40f35edf9 100644 --- a/BedrockCore.cpp +++ b/BedrockCore.cpp @@ -125,7 +125,6 @@ void BedrockCore::prePeekCommand(unique_ptr& command) { } BedrockCore::RESULT BedrockCore::peekCommand(unique_ptr& command, bool exclusive) { - AutoTimer timer(command, exclusive ? BedrockCommand::BLOCKING_PEEK : BedrockCommand::PEEK); BedrockServer::ScopedStateSnapshot snapshot(_server); command->lastPeekedOrProcessedInState = _server.getState(); @@ -146,6 +145,9 @@ BedrockCore::RESULT BedrockCore::peekCommand(unique_ptr& command STHROW("501 Failed to begin " + (exclusive ? "exclusive"s : "shared"s) + " transaction"); } + // We start the timer here to avoid including the time spent acquiring the lock _sharedData.commitLock + AutoTimer timer(command, exclusive ? BedrockCommand::BLOCKING_PEEK : BedrockCommand::PEEK); + // Make sure no writes happen while in peek command _db.setQueryOnly(true);