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,
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue