diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-07-27 16:19:34 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-07-30 09:51:14 -0400 |
commit | 8c326de66475125ce755c52d36340b52f86ac64e (patch) | |
tree | 45ba12e37ddd23212a4df1289da7ea5d0a4557b3 /src/mongo/db/operation_context.cpp | |
parent | 1af99e48949f36754e2b877f1057bdaba0b83aea (diff) | |
download | mongo-8c326de66475125ce755c52d36340b52f86ac64e.tar.gz |
SERVER-25050 Set maxTimeMS on OperationContext on mongos
This change makes mongos commands to retrieve the maxTimeMS from the
command and set it on the OperationContext.
Diffstat (limited to 'src/mongo/db/operation_context.cpp')
-rw-r--r-- | src/mongo/db/operation_context.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/operation_context.cpp b/src/mongo/db/operation_context.cpp index 58529dffedf..2a5c8814bf3 100644 --- a/src/mongo/db/operation_context.cpp +++ b/src/mongo/db/operation_context.cpp @@ -139,6 +139,15 @@ bool OperationContext::hasDeadlineExpired() const { return now >= getDeadline(); } +Milliseconds OperationContext::getRemainingMaxTimeMillis() const { + if (!hasDeadline()) { + return Milliseconds::max(); + } + + return std::max(Milliseconds{0}, + getDeadline() - getServiceContext()->getFastClockSource()->now()); +} + Microseconds OperationContext::getRemainingMaxTimeMicros() const { if (!hasDeadline()) { return Microseconds::max(); |