From 6c115aa8b2ad9ef13b891bc9066eabd5ff2ca0bf Mon Sep 17 00:00:00 2001 From: Jonatan Nilsson Date: Fri, 16 Feb 2024 06:47:47 +0000 Subject: [PATCH] core: In application, move version into context --- core/application.mjs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/application.mjs b/core/application.mjs index 83e6ef5..3f9957c 100644 --- a/core/application.mjs +++ b/core/application.mjs @@ -26,7 +26,8 @@ export default class Application extends EventEmitter { getLog: getLog, HttpServer: HttpServer, request: request, - } + }, + version: '', } this.config = defaults({}, this.ctx.db.config[name]) this.provider = provider @@ -34,7 +35,6 @@ export default class Application extends EventEmitter { this.updating = false this.http = new HttpServer(this.config) this.module = null - this.running = '' this.workers = {} // Fresh is used to indicate that when we run the application and it fails, @@ -390,14 +390,14 @@ export default class Application extends EventEmitter { runVersion(version) { this.ctx.db.data.core[this.name].active = version - this.running = version - this.emit('running', this.running) + this.ctx.version = version + this.emit('running', this.ctx.version) return this.ctx.db.write().then(() => { return this._runVersion(version) .catch((err) => { - this.running = '' - this.emit('running', this.running) + this.ctx.version = '' + this.emit('running', this.ctx.version) return Promise.reject(err) }) }) @@ -477,8 +477,8 @@ export default class Application extends EventEmitter { } closeServer() { - this.running = '' - this.emit('running', this.running) + this.ctx.version = '' + this.emit('running', this.ctx.version) if (this.config.cluster && !this.isSlave) { if (this.__clusterWorkerDied) { this.cluster.off('exit', this.__clusterWorkerDied)