Make webapp a follower of proxy.

Should get rid of the occasional case of webapp connecting to the proxy
leadership group when it wants the admin proxy, and vice versa.
This commit is contained in:
Emily Stark
2013-10-24 16:40:08 -07:00
parent 87562f0ccd
commit 87e5324a8e
3 changed files with 18 additions and 8 deletions

View File

@@ -79,7 +79,13 @@ Follower = {
var tryElector = function (url) {
url = url || findFewestTries();
//console.log("trying", url, electorTries, tryingUrl);
// console.log("trying", url, electorTries, tryingUrl);
// Don't keep trying the same url as fast as we can if it's not working.
if (electorTries[url] > 2) {
Meteor._sleepForMs(3 * 1000);
}
if (conn) {
conn._reconnectImpl({
url: url

View File

@@ -9,7 +9,7 @@ Npm.depends({connect: "2.9.0",
Package.on_use(function (api) {
api.use(['logging', 'underscore', 'routepolicy'], 'server');
api.use(['application-configuration', 'livedata'], {
api.use(['application-configuration', 'follower-livedata'], {
unordered: true
});
// At response serving time, webapp uses browser-policy if it is loaded. If

View File

@@ -429,8 +429,8 @@ var runWebAppServer = function () {
if (proxyBinding)
proxyBinding.stop();
if (configuration && configuration.proxy) {
proxyBinding = AppConfig.configureService(configuration.proxyServiceName ||
"proxy", function (proxyService) {
var proxyServiceName = configuration.proxyServiceName || "proxy";
proxyBinding = AppConfig.configureService(proxyServiceName, function (proxyService) {
if (proxyService.providers.proxy) {
var proxyConf;
if (process.env.ADMIN_APP) {
@@ -447,7 +447,7 @@ var runWebAppServer = function () {
Log("Attempting to bind to proxy at " + proxyService.providers.proxy);
WebAppInternals.bindToProxy(_.extend({
proxyEndpoint: proxyService.providers.proxy
}, proxyConf));
}, proxyConf), proxyServiceName);
}
});
}
@@ -468,7 +468,7 @@ var runWebAppServer = function () {
};
};
WebAppInternals.bindToProxy = function (proxyConfig) {
WebAppInternals.bindToProxy = function (proxyConfig, proxyServiceName) {
var securePort = proxyConfig.securePort || 4433;
var insecurePort = proxyConfig.insecurePort || 8080;
var bindPathPrefix = proxyConfig.bindPathPrefix || "";
@@ -498,8 +498,12 @@ WebAppInternals.bindToProxy = function (proxyConfig) {
};
// This is run after packages are loaded (in main) so we can use
// DDP.connect.
var proxy = Package.livedata.DDP.connect(proxyConfig.proxyEndpoint);
// Follower.connect.
var proxy = Package["follower-livedata"].Follower.connect(
proxyConfig.proxyEndpoint, {
group: proxyServiceName
}
);
var route = process.env.ROUTE;
var host = route.split(":")[0];
var port = +route.split(":")[1];