You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/02/28 18:55:23 UTC
[05/10] mesos git commit: Added check to not Subscribe if we are
already subscribed.
Added check to not Subscribe if we are already subscribed.
This change adds a check to ensure that we don't `Subscribe` again in case we
already have a `SubscribedResponse` stream set. With pipelining, we won't be
able to send more then 1 subscribe calls on the `Subscribe` connection.
In case, the scheduler sends two subscribe calls simultaneously before the
subscribed response stream could be established. We would invoke the
`disconnected`/`connected` callback, making the scheduler subscribe again.
Review: https://reviews.apache.org/r/43661/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/3a9d8871
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/3a9d8871
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/3a9d8871
Branch: refs/heads/master
Commit: 3a9d887167599f056b69b247c13b2ebaff4c4ddd
Parents: d891d96
Author: Anand Mazumdar <ma...@gmail.com>
Authored: Sun Feb 28 09:52:12 2016 -0800
Committer: Vinod Kone <vi...@gmail.com>
Committed: Sun Feb 28 09:52:12 2016 -0800
----------------------------------------------------------------------
src/scheduler/scheduler.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/3a9d8871/src/scheduler/scheduler.cpp
----------------------------------------------------------------------
diff --git a/src/scheduler/scheduler.cpp b/src/scheduler/scheduler.cpp
index d39cf9d..7dd1e1f 100644
--- a/src/scheduler/scheduler.cpp
+++ b/src/scheduler/scheduler.cpp
@@ -213,8 +213,12 @@ public:
Future<Response> response;
if (call.type() == Call::SUBSCRIBE) {
- // Each subscription requires a new connection.
- disconnect();
+ // It might be possible that the scheduler is retrying when it already
+ // has an active subscribe response stream.
+ if (subscribed.isSome()) {
+ drop(call, "Scheduler is already subscribed");
+ return;
+ }
// Send a streaming request for Subscribe call.
response = process::http::streaming::post(