summaryrefslogtreecommitdiff
path: root/src/mongo/db/dbcommands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/dbcommands.cpp')
-rw-r--r--src/mongo/db/dbcommands.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp
index aaaf4f7de67..4b4a6089364 100644
--- a/src/mongo/db/dbcommands.cpp
+++ b/src/mongo/db/dbcommands.cpp
@@ -1352,7 +1352,12 @@ void Command::execCommand(OperationContext* txn,
"no such command option $maxTimeMs; use maxTimeMS instead",
extractedFields[kQueryOptionMaxTimeMSField].eoo());
- txn->setMaxTimeMicros(static_cast<unsigned long long>(maxTimeMS) * 1000);
+ if (maxTimeMS > 0) {
+ uassert(40119,
+ "Illegal attempt to set operation deadline within DBDirectClient",
+ !txn->getClient()->isInDirectClient());
+ txn->setDeadlineAfterNowBy(Milliseconds{maxTimeMS});
+ }
// Operations are only versioned against the primary. We also make sure not to redo shard
// version handling if this command was issued via the direct client.