You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ne...@apache.org on 2017/04/26 18:20:53 UTC

[07/11] mesos git commit: Cleaned up coding of `DRFComparator::operator()`.

Cleaned up coding of `DRFComparator::operator()`.

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


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

Branch: refs/heads/master
Commit: 5bf32be976c404aa1834a1dbd378c0ef37173856
Parents: 3d8faf5
Author: Neil Conway <ne...@gmail.com>
Authored: Thu Mar 30 19:09:21 2017 -0700
Committer: Neil Conway <ne...@gmail.com>
Committed: Wed Apr 26 14:02:15 2017 -0400

----------------------------------------------------------------------
 src/master/allocator/sorter/drf/sorter.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/5bf32be9/src/master/allocator/sorter/drf/sorter.cpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/sorter/drf/sorter.cpp b/src/master/allocator/sorter/drf/sorter.cpp
index ee5b8c0..7e91c85 100644
--- a/src/master/allocator/sorter/drf/sorter.cpp
+++ b/src/master/allocator/sorter/drf/sorter.cpp
@@ -44,13 +44,15 @@ namespace allocator {
 
 bool DRFComparator::operator()(const Client& client1, const Client& client2)
 {
-  if (client1.share == client2.share) {
-    if (client1.allocation.count == client2.allocation.count) {
-      return client1.name < client2.name;
-    }
+  if (client1.share != client2.share) {
+    return client1.share < client2.share;
+  }
+
+  if (client1.allocation.count != client2.allocation.count) {
     return client1.allocation.count < client2.allocation.count;
   }
-  return client1.share < client2.share;
+
+  return client1.name < client2.name;
 }