diff options
author | Jonathan Reams <jbreams@mongodb.com> | 2016-09-29 14:29:46 -0400 |
---|---|---|
committer | Jonathan Reams <jbreams@mongodb.com> | 2016-09-30 12:09:34 -0400 |
commit | cb9e5e2f0a8ea4c47747e9eeac1aa4524092ea57 (patch) | |
tree | 7541a3a6cb8ac88b71fd2b582b25c861e5c4c20c /src | |
parent | 637ddd4b1c740c54f658be5583336c029fd5de87 (diff) | |
download | mongo-cb9e5e2f0a8ea4c47747e9eeac1aa4524092ea57.tar.gz |
SERVER-26389 Make javascript periodic interrupts disabled by default
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/scripting/deadline_monitor.cpp | 2 | ||||
-rw-r--r-- | src/mongo/scripting/deadline_monitor.h | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/mongo/scripting/deadline_monitor.cpp b/src/mongo/scripting/deadline_monitor.cpp index 5eb0f52e5de..f75c34a0cc2 100644 --- a/src/mongo/scripting/deadline_monitor.cpp +++ b/src/mongo/scripting/deadline_monitor.cpp @@ -34,7 +34,7 @@ namespace mongo { -MONGO_EXPORT_SERVER_PARAMETER(scriptingEngineInterruptIntervalMS, int, 1000); +MONGO_EXPORT_SERVER_PARAMETER(scriptingEngineInterruptIntervalMS, int, 0); int getScriptingEngineInterruptInterval() { return scriptingEngineInterruptIntervalMS.load(); 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()); |