You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2014/10/16 03:54:58 UTC

git commit: Expose poll interval from the reaper.

Repository: mesos
Updated Branches:
  refs/heads/master c46e502dc -> 4693728e4


Expose poll interval from the reaper.

Review: https://reviews.apache.org/r/26229


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/4693728e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/4693728e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/4693728e

Branch: refs/heads/master
Commit: 4693728e4f604a1cff6f01d5f2d8f0ec60eb2f96
Parents: c46e502
Author: Alexander Rukletsov <al...@mesosphere.io>
Authored: Wed Oct 15 18:53:32 2014 -0700
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Wed Oct 15 18:54:37 2014 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/reap.hpp |  3 +++
 3rdparty/libprocess/src/reap.cpp             | 13 +++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/4693728e/3rdparty/libprocess/include/process/reap.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/reap.hpp b/3rdparty/libprocess/include/process/reap.hpp
index 9de5336..5e5051a 100644
--- a/3rdparty/libprocess/include/process/reap.hpp
+++ b/3rdparty/libprocess/include/process/reap.hpp
@@ -9,6 +9,9 @@
 
 namespace process {
 
+// The upper bound for the poll interval in the reaper.
+Duration MAX_REAP_INTERVAL();
+
 // Returns the exit status of the specified process if and only if
 // the process is a direct child and it has not already been reaped.
 // Otherwise, returns None once the process has been reaped elsewhere

http://git-wip-us.apache.org/repos/asf/mesos/blob/4693728e/3rdparty/libprocess/src/reap.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/reap.cpp b/3rdparty/libprocess/src/reap.cpp
index ac14a86..afd956b 100644
--- a/3rdparty/libprocess/src/reap.cpp
+++ b/3rdparty/libprocess/src/reap.cpp
@@ -41,10 +41,10 @@ namespace process {
 //                       (# pids)
 //
 const size_t LOW_PID_COUNT = 50;
-const Duration LOW_INTERVAL = Milliseconds(100);
+Duration MIN_REAP_INTERVAL() { return Milliseconds(100); }
 
 const size_t HIGH_PID_COUNT = 500;
-const Duration HIGH_INTERVAL = Seconds(1);
+Duration MAX_REAP_INTERVAL() { return Seconds(1); }
 
 
 class ReaperProcess : public Process<ReaperProcess>
@@ -113,16 +113,17 @@ private:
     size_t count = promises.size();
 
     if (count <= LOW_PID_COUNT) {
-      return LOW_INTERVAL;
+      return MIN_REAP_INTERVAL();
     } else if (count >= HIGH_PID_COUNT) {
-      return HIGH_INTERVAL;
+      return MAX_REAP_INTERVAL();
     }
 
-    // Linear interpolation between LOW_INTERVAL and HIGH_INTERVAL.
+    // Linear interpolation between min and max reap intervals.
     double fraction =
       ((double) (count - LOW_PID_COUNT) / (HIGH_PID_COUNT - LOW_PID_COUNT));
 
-    return LOW_INTERVAL + (HIGH_INTERVAL - LOW_INTERVAL) * fraction;
+    return (MIN_REAP_INTERVAL() +
+            (MAX_REAP_INTERVAL() - MIN_REAP_INTERVAL()) * fraction);
   }
 
   multihashmap<pid_t, Owned<Promise<Option<int> > > > promises;