Skip to content

Commit

Permalink
Call updateTags on proxy in ctl
Browse files Browse the repository at this point in the history
  • Loading branch information
Naomi Seyfer committed Dec 13, 2013
1 parent 7da8004 commit 9373bce
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions packages/ctl/ctl.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,32 @@ Ctl.Commands.push({
});
// Wait for them all to come up and bind to the proxy.
Meteor._sleepForMs(5000); // XXX: Eventually make sure they're proxy-bound.
var proxy;
var proxyTagSwitchFuture = new Future;
AppConfig.configureService('proxy', function (proxyService) {
try {
proxy = Follower.connect(proxyService.providers.proxy, {
group: "proxy"
});
proxy.call('updateTags', Ctl.myAppName(), ['', thisJob.star]);
proxy.disconnect();
if (!proxyTagSwitchFuture.isResolved())
proxyTagSwitchFuture['return']();
} catch (e) {
if (!proxyTagSwitchFuture.isResolved())
proxyTagSwitchFuture['throw'](e);
}
});

var proxyTimeout = Meteor.setTimeout(function () {
if (!proxyTagSwitchFuture.isResolved())
proxyTagSwitchFuture['throw'](new Error("timed out looking for a proxy " +
"or trying to change tags on it " +
proxy.status().status));
}, 10*1000);
proxyTagSwitchFuture.wait();
Meteor.clearTimeout(proxyTimeout);

// (eventually) tell the proxy to switch over to using the new star
// One by one, kill all the old star's server jobs.
var jobToKill = jobs.findOne(oldJobSelector);
Expand All @@ -161,6 +187,7 @@ Ctl.Commands.push({
Ctl.kill(job.program, job._id);
});
// fin
process.exit(0);
}
});

Expand Down
2 changes: 1 addition & 1 deletion packages/ctl/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Package.describe({
});

Package.on_use(function (api) {
api.use(['underscore', 'livedata', 'mongo-livedata', 'ctl-helper'], 'server');
api.use(['underscore', 'livedata', 'mongo-livedata', 'ctl-helper', 'application-configuration', 'follower-livedata'], 'server');
api.export('main', 'server');
api.add_files('ctl.js', 'server');
});

0 comments on commit 9373bce

Please sign in to comment.