kopia lustrzana https://github.com/c9/core
More functions, less comments
rodzic
7279d926f1
commit
a4e8ee0e48
|
@ -261,20 +261,31 @@ define(function(require, exports, module) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Kick off some parallel runners to find a vfs server.
|
function startParallelSearches (totalRunners) {
|
||||||
var attemptedServers = {}; // Keep a list of servers we've attempted so upon this first parallel attempt we don't just smash all ports on the same vfs server.
|
var attemptedServers = {};
|
||||||
for (var s = 0; s < servers.length && s < PARALLEL_SEARCHES; s++) {
|
for (var s = 0; s < servers.length && s < totalRunners; s++) {
|
||||||
latestServer = s; // Keep in sync with s, if runners fail we want them to try other vfs server's starting from nextServer
|
latestServer = s;
|
||||||
var server = servers[s];
|
var server = servers[s];
|
||||||
var serverMatch = server.url.match(/vfs-gce-[a-z]+-[0-9]+/); // server.url looks like: https://vfs-gce-ae-09-2.c9.io or https://vfs.c9.dev/vfs we're grabbing the base url of the host (without the -2)
|
var serverHostname = getHostFromServerUrl(server.url);
|
||||||
var serverBaseUrl = serverMatch ? serverMatch[0] : server.url;
|
if (!attemptedServers[serverHostname]) {
|
||||||
if (!attemptedServers[serverBaseUrl]) {
|
attemptedServers[serverHostname] = true;
|
||||||
attemptedServers[serverBaseUrl] = true;
|
|
||||||
tryNext(s);
|
tryNext(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
startParallelSearches(PARALLEL_SEARCHES);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getHostFromServerUrl(serverUrl) {
|
||||||
|
// server.url looks like: https://vfs-gce-ae-09-2.c9.io or https://vfs.c9.dev/vfs we're grabbing the base url of the host (without the -2)
|
||||||
|
var serverMatch = serverUrl.replace(/^(https:..[^.]+-\d+)(-\d+)(.*)/, "$1$3");
|
||||||
|
if (serverMatch) {
|
||||||
|
return serverMatch[0];
|
||||||
|
}
|
||||||
|
return serverUrl;
|
||||||
|
}
|
||||||
|
|
||||||
function onProtocolChange(callback) {
|
function onProtocolChange(callback) {
|
||||||
// I'm keeping this vague because we don't want users to blame
|
// I'm keeping this vague because we don't want users to blame
|
||||||
// a "cloud9 update" for losing work
|
// a "cloud9 update" for losing work
|
||||||
|
|
Ładowanie…
Reference in New Issue