core: In application, move version into context
Some checks failed
continuous-integration/appveyor/branch AppVeyor build failed
Some checks failed
continuous-integration/appveyor/branch AppVeyor build failed
This commit is contained in:
parent
5d39f776e1
commit
6c115aa8b2
1 changed files with 8 additions and 8 deletions
|
@ -26,7 +26,8 @@ export default class Application extends EventEmitter {
|
||||||
getLog: getLog,
|
getLog: getLog,
|
||||||
HttpServer: HttpServer,
|
HttpServer: HttpServer,
|
||||||
request: request,
|
request: request,
|
||||||
}
|
},
|
||||||
|
version: '',
|
||||||
}
|
}
|
||||||
this.config = defaults({}, this.ctx.db.config[name])
|
this.config = defaults({}, this.ctx.db.config[name])
|
||||||
this.provider = provider
|
this.provider = provider
|
||||||
|
@ -34,7 +35,6 @@ export default class Application extends EventEmitter {
|
||||||
this.updating = false
|
this.updating = false
|
||||||
this.http = new HttpServer(this.config)
|
this.http = new HttpServer(this.config)
|
||||||
this.module = null
|
this.module = null
|
||||||
this.running = ''
|
|
||||||
this.workers = {}
|
this.workers = {}
|
||||||
|
|
||||||
// Fresh is used to indicate that when we run the application and it fails,
|
// 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) {
|
runVersion(version) {
|
||||||
this.ctx.db.data.core[this.name].active = version
|
this.ctx.db.data.core[this.name].active = version
|
||||||
this.running = version
|
this.ctx.version = version
|
||||||
this.emit('running', this.running)
|
this.emit('running', this.ctx.version)
|
||||||
|
|
||||||
return this.ctx.db.write().then(() => {
|
return this.ctx.db.write().then(() => {
|
||||||
return this._runVersion(version)
|
return this._runVersion(version)
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
this.running = ''
|
this.ctx.version = ''
|
||||||
this.emit('running', this.running)
|
this.emit('running', this.ctx.version)
|
||||||
return Promise.reject(err)
|
return Promise.reject(err)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -477,8 +477,8 @@ export default class Application extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
closeServer() {
|
closeServer() {
|
||||||
this.running = ''
|
this.ctx.version = ''
|
||||||
this.emit('running', this.running)
|
this.emit('running', this.ctx.version)
|
||||||
if (this.config.cluster && !this.isSlave) {
|
if (this.config.cluster && !this.isSlave) {
|
||||||
if (this.__clusterWorkerDied) {
|
if (this.__clusterWorkerDied) {
|
||||||
this.cluster.off('exit', this.__clusterWorkerDied)
|
this.cluster.off('exit', this.__clusterWorkerDied)
|
||||||
|
|
Loading…
Reference in a new issue