Merge pull request +10552 from c9/improve-dogfooding

Better, faster dogfooding
pull/223/head
Lennart Kats 2015-11-18 15:46:08 +01:00
commit dd223c8d38
6 zmienionych plików z 25 dodań i 24 usunięć

Wyświetl plik

@ -303,9 +303,7 @@ module.exports = function(options) {
{ {
packagePath: "plugins/c9.ide.language/language", packagePath: "plugins/c9.ide.language/language",
workspaceDir: workspaceDir, workspaceDir: workspaceDir,
staticPrefix: hosted && !options.packed staticPrefix: staticPrefix,
? options.ideBaseUrl + "/uph" + staticPrefix
: staticPrefix,
workerPrefix: options.CORSWorkerPrefix // "/static/standalone/worker" workerPrefix: options.CORSWorkerPrefix // "/static/standalone/worker"
}, },
"plugins/c9.ide.language/keyhandler", "plugins/c9.ide.language/keyhandler",

Wyświetl plik

@ -48,12 +48,13 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
if (config.get("packaged") || !require.toUrl) { if (config.get("packaged") || !require.toUrl) {
workerUrl = workerUrl || config.moduleUrl(mod, "worker"); workerUrl = workerUrl || config.moduleUrl(mod, "worker");
} else { } else {
var skipBalancers = true; // load all scripts from one domain, workers don't support CORS headers
var normalizePath = this.$normalizePath; var normalizePath = this.$normalizePath;
workerUrl = workerUrl || normalizePath(require.toUrl("ace/worker/worker.js", null, "_")); workerUrl = workerUrl || normalizePath(require.toUrl("ace/worker/worker.js", null, "_", skipBalancers));
var tlns = {}; var tlns = {};
topLevelNamespaces.forEach(function(ns) { topLevelNamespaces.forEach(function(ns) {
tlns[ns] = normalizePath(require.toUrl(ns, null, "_").replace(/(\.js)?(\?.*)?$/, "")); tlns[ns] = normalizePath(require.toUrl(ns, null, "_", skipBalancers).replace(/(\.js)?(\?.*)?$/, ""));
}); });
} }

Wyświetl plik

@ -152,8 +152,8 @@ var activateModule = function(name) {
var req = function(path, callback) { var req = function(path, callback) {
return _require(name, path, callback); return _require(name, path, callback);
}; };
req.toUrl = function(namePlusExt) { req.toUrl = function(namePlusExt, _1, _2, skipBalancers) {
return require.toUrl(normalizeName(name, namePlusExt)); return require.toUrl(normalizeName(name, namePlusExt), null, null, skipBalancers);
}; };
req.config = require.config; req.config = require.config;
@ -315,7 +315,7 @@ function undefAll(module, hash) {
require.MODULE_LOAD_URL = MODULE_LOAD_URL; require.MODULE_LOAD_URL = MODULE_LOAD_URL;
require.toUrl = function(moduleName, ext, skipExt) { require.toUrl = function(moduleName, ext, skipExt, skipBalancers) {
var absRe = /^([\w\+\.\-]+:|\/)/; var absRe = /^([\w\+\.\-]+:|\/)/;
var index = moduleName.indexOf("!"); var index = moduleName.indexOf("!");
if (index !== -1 || !ext || /^\/|\.js$/.test(moduleName)) if (index !== -1 || !ext || /^\/|\.js$/.test(moduleName))
@ -347,7 +347,7 @@ require.toUrl = function(moduleName, ext, skipExt) {
if (!absRe.test(url)) { if (!absRe.test(url)) {
url = (config.baseUrl || require.MODULE_LOAD_URL + "/") + url; url = (config.baseUrl || require.MODULE_LOAD_URL + "/") + url;
} }
if (url[0] === "/" && config.baseUrlLoadBalancers) { if (url[0] === "/" && config.baseUrlLoadBalancers && !skipBalancers) {
var n = Math.abs(hashCode(url)) % config.baseUrlLoadBalancers.length; var n = Math.abs(hashCode(url)) % config.baseUrlLoadBalancers.length;
url = config.baseUrlLoadBalancers[n] + url; url = config.baseUrlLoadBalancers[n] + url;
} }

Wyświetl plik

@ -114,6 +114,6 @@
"c9.ide.threewaymerge": "#229382aa0b", "c9.ide.threewaymerge": "#229382aa0b",
"c9.ide.undo": "#b028bcb4d5", "c9.ide.undo": "#b028bcb4d5",
"c9.ide.upload": "#0bd010d3dc", "c9.ide.upload": "#0bd010d3dc",
"c9.ide.welcome": "#412fe300da" "c9.ide.welcome": "#7450aebef6"
} }
} }

Wyświetl plik

@ -1,3 +1,9 @@
/**
* unpacked_helper speeds up the unpacked version of Cloud9
* by using more parallel connections and avoiding
* subsubdomains on dogfooding (e.g., ide.dev-lennartcl.c9.io, where
* Chrome doesn't support any caching).
*/
"use strict"; "use strict";
plugin.consumes = [ plugin.consumes = [
@ -18,20 +24,11 @@ function plugin(options, imports, register) {
assert(ideBaseUrl, "ideBaseUrl must be set"); assert(ideBaseUrl, "ideBaseUrl must be set");
var balancers = [ var balancers = [
baseUrl + "/uph", baseUrl + "/_unp",
baseUrl + ":8080/_unp",
baseUrl + ":8081/_unp",
baseUrl + ":8082/_unp",
]; ];
/* UNDONE: for now we put all static content on one domain
because of reports of CORS errors
if (!options.avoidSubdomains)
balancers.push(
ideBaseUrl
// We could include others but dogfooding URLs like
// vfs.newclient-lennartcl.c9.io don't have a cert, so
// let's not
// apiBaseUrl + "/uph",
// vfsBaseUrl + "/uph"
);
*/
connectStatic.getRequireJsConfig().baseUrlLoadBalancers = balancers; connectStatic.getRequireJsConfig().baseUrlLoadBalancers = balancers;
assert(connectStatic.getRequireJsConfig().baseUrlLoadBalancers); assert(connectStatic.getRequireJsConfig().baseUrlLoadBalancers);

Wyświetl plik

@ -29,7 +29,12 @@ var shortcuts = {
"s": ["standalone", "-s", "standalone"] "s": ["standalone", "-s", "standalone"]
}; };
shortcuts.odev = shortcuts.onlinedev; // For backwards compatibility, if you see this in 2016 remove this line shortcuts.odev = shortcuts.onlinedev; // For backwards compatibility, if you see this in 2016 remove this line
var delayLoadConfigs = ["preview", "user-content", "api", "oldclient", "apps-proxy", "worker"]; var delayLoadConfigs = [
// Services that are usually not immediately needed
"preview", "user-content", "api", "apps-proxy", "worker",
// Services that are very slow to load, blocking others
"profile",
];
module.exports = main; module.exports = main;