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 2018/09/06 02:00:31 UTC

[mesos] 02/03: Avoided triple-lookup of the framework in Master::offer.

This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 7e7ef60d265382e64dab3f93e8d5f101ab223f21
Author: Benjamin Mahler <bm...@apache.org>
AuthorDate: Wed Sep 5 14:50:53 2018 -0700

    Avoided triple-lookup of the framework in Master::offer.
    
    Review: https://reviews.apache.org/r/68635
---
 src/master/master.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/master/master.cpp b/src/master/master.cpp
index 7bc924f..9179cf3 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -9228,8 +9228,9 @@ void Master::offer(
     const FrameworkID& frameworkId,
     const hashmap<string, hashmap<SlaveID, Resources>>& resources)
 {
-  if (!frameworks.registered.contains(frameworkId) ||
-      !frameworks.registered[frameworkId]->active()) {
+  Framework* framework = getFramework(frameworkId);
+
+  if (framework == nullptr || !framework->active()) {
     LOG(WARNING) << "Master returning resources offered to framework "
                  << frameworkId << " because the framework"
                  << " has terminated or is inactive";
@@ -9244,7 +9245,6 @@ void Master::offer(
     return;
   }
 
-  Framework* framework = CHECK_NOTNULL(frameworks.registered.at(frameworkId));
 
   // Each offer we create is tied to a single agent
   // and a single allocation role.