summaryrefslogtreecommitdiff
path: root/src/mongo/scripting/deadline_monitor.h
diff options
context:
space:
mode:
authorJonathan Reams <jbreams@mongodb.com>2016-09-29 14:29:46 -0400
committerJonathan Reams <jbreams@mongodb.com>2016-09-30 12:09:34 -0400
commitcb9e5e2f0a8ea4c47747e9eeac1aa4524092ea57 (patch)
tree7541a3a6cb8ac88b71fd2b582b25c861e5c4c20c /src/mongo/scripting/deadline_monitor.h
parent637ddd4b1c740c54f658be5583336c029fd5de87 (diff)
downloadmongo-cb9e5e2f0a8ea4c47747e9eeac1aa4524092ea57.tar.gz
SERVER-26389 Make javascript periodic interrupts disabled by default
Diffstat (limited to 'src/mongo/scripting/deadline_monitor.h')
-rw-r--r--src/mongo/scripting/deadline_monitor.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mongo/scripting/deadline_monitor.h b/src/mongo/scripting/deadline_monitor.h
index 127bc81288d..a39b78971c5 100644
--- a/src/mongo/scripting/deadline_monitor.h
+++ b/src/mongo/scripting/deadline_monitor.h
@@ -139,7 +139,7 @@ private:
const Date_t now = Date_t::now();
const auto interruptInterval = Milliseconds{getScriptingEngineInterruptInterval()};
- if (now - lastInterruptCycle > interruptInterval) {
+ if ((interruptInterval.count() > 0) && (now - lastInterruptCycle > interruptInterval)) {
for (const auto& task : _tasks) {
if (task.second > now)
task.first->interrupt();
@@ -149,9 +149,13 @@ private:
// wait for a task to be added or a deadline to expire
if (_nearestDeadlineWallclock > now) {
- if (_nearestDeadlineWallclock == Date_t::max() ||
- _nearestDeadlineWallclock - now > interruptInterval) {
- _newDeadlineAvailable.wait_for(lk, interruptInterval.toSystemDuration());
+ if (_nearestDeadlineWallclock == Date_t::max()) {
+ if ((interruptInterval.count() > 0) &&
+ (_nearestDeadlineWallclock - now > interruptInterval)) {
+ _newDeadlineAvailable.wait_for(lk, interruptInterval.toSystemDuration());
+ } else {
+ _newDeadlineAvailable.wait(lk);
+ }
} else {
_newDeadlineAvailable.wait_until(lk,
_nearestDeadlineWallclock.toSystemTimePoint());