wait for 30 seconds in taskmanager instead
problem: because the apps are not inserted into appdb, the cloudron starts out with an empty view. apps appear suddenly after 30 seconds. besides, it makes more sense because 30 secs is not really tied to first run
This commit is contained in:
@@ -24,6 +24,7 @@ var appdb = require('./appdb.js'),
|
||||
|
||||
var gActiveTasks = { };
|
||||
var gPendingTasks = [ ];
|
||||
var gPlatformReady = false; // PaaS (addons) up and running
|
||||
|
||||
var TASK_CONCURRENCY = 5;
|
||||
var NOOP_CALLBACK = function (error) { if (error) console.error(error); };
|
||||
@@ -39,6 +40,11 @@ function initialize(callback) {
|
||||
cloudron.events.on(cloudron.EVENT_CONFIGURED, resumeTasks);
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
gPlatformReady = true;
|
||||
resumeTasks();
|
||||
}, 30000); // wait 30 seconds to signal platform ready
|
||||
|
||||
callback();
|
||||
}
|
||||
|
||||
@@ -106,6 +112,12 @@ function startAppTask(appId, callback) {
|
||||
return callback(new Error(util.format('Task for %s is already active', appId)));
|
||||
}
|
||||
|
||||
if (!gPlatformReady) {
|
||||
debug('Platform not ready yet, queueing task for %s', appId);
|
||||
gPendingTasks.push(appId);
|
||||
return callback();
|
||||
}
|
||||
|
||||
if (Object.keys(gActiveTasks).length >= TASK_CONCURRENCY) {
|
||||
debug('Reached concurrency limit, queueing task for %s', appId);
|
||||
gPendingTasks.push(appId);
|
||||
|
||||
Reference in New Issue
Block a user