From eadbeb0498138e9acc9e172e466312103843f651 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 1 Jun 2018 12:27:12 -0400 Subject: [PATCH] use monitor as a service --- lib/core/engine.js | 19 ++++++++++--------- lib/index.js | 6 +++--- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/core/engine.js b/lib/core/engine.js index 6722c485..5224a50a 100644 --- a/lib/core/engine.js +++ b/lib/core/engine.js @@ -71,15 +71,6 @@ class Engine { }; } - startMonitor() { - const self = this; - this.servicesMonitor = new ServicesMonitor({events: this.events, logger: this.logger, plugins: this.plugins}); - this.servicesMonitor.addCheck('embarkVersion', function (cb) { - return cb({name: 'Embark ' + self.version, status: 'on'}); - }, 0); - this.servicesMonitor.startMonitor(); - } - registerModule(moduleName, options) { this.plugins.loadInternalPlugin(moduleName, options || {}); } @@ -88,6 +79,7 @@ class Engine { let options = _options || {}; let services = { + "serviceMonitor": this.serviceMonitor, "pipeline": this.pipelineService, "codeRunner": this.codeRunnerService, "codeGenerator": this.codeGeneratorService, @@ -134,6 +126,15 @@ class Engine { }); } + serviceMonitor() { + const self = this; + this.servicesMonitor = new ServicesMonitor({events: this.events, logger: this.logger, plugins: this.plugins}); + this.servicesMonitor.addCheck('embarkVersion', function (cb) { + return cb({name: 'Embark ' + self.version, status: 'on'}); + }, 0); + this.servicesMonitor.startMonitor(); + } + namingSystem(_options) { this.registerModule('ens'); } diff --git a/lib/index.js b/lib/index.js index 48ce9d63..ca034230 100644 --- a/lib/index.js +++ b/lib/index.js @@ -114,7 +114,7 @@ class Embark { engine.logger.info(__("loaded plugins") + ": " + pluginList.join(", ")); } - engine.startMonitor(); + engine.startService("serviceMonitor"); engine.startService("libraryManager"); engine.startService("codeRunner"); engine.startService("web3"); @@ -238,7 +238,7 @@ class Embark { engine.logger.info(__("loaded plugins") + ": " + pluginList.join(", ")); } - engine.startMonitor(); + engine.startService("serviceMonitor"); engine.startService("libraryManager"); engine.startService("pipeline"); engine.startService("deployment", {onlyCompile: true}); @@ -300,7 +300,7 @@ class Embark { function startServices(callback) { - engine.startMonitor(); + engine.startService("serviceMonitor"); engine.startService("libraryManager"); engine.startService("codeRunner"); engine.startService("web3");