Skip to content
Snippets Groups Projects
Commit 7f4ddec7 authored by italo's avatar italo
Browse files

Add a callback to let components know app started

parent cdeffd70
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ const WebHooks = require("./web_hooks.js");
const WebServer = require("./web_server.js");
const redis = require("redis");
const UserMapping = require("./userMapping.js");
const async = require("async");
// Class that defines the application. Listens for events on redis and starts the
// process to perform the callback calls.
......@@ -18,13 +19,18 @@ module.exports = class Application {
this.webServer = new WebServer();
}
start() {
start(callback) {
Hook.initialize(() => {
UserMapping.initialize(() => {
IDMapping.initialize(()=> {
this.webServer.start(config.server.port);
this.webServer.createPermanents();
this.webHooks.start();
async.parallel([
(callback) => { this.webServer.start(config.server.port, callback) },
(callback) => { this.webServer.createPermanents(callback) },
(callback) => { this.webHooks.start(callback) }
], (err,results) => {
if(err != null) {}
typeof callback === 'function' ? callback() : undefined;
});
});
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment