Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
fix: component lifecycle methods should always return Promise
Browse files Browse the repository at this point in the history
  • Loading branch information
robertrossmann committed Nov 29, 2018
1 parent 51dc591 commit 2417929
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/atlas/test/aliasing.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('Atlas: cross-component communication', () => {
}

class DummyService extends Service {
prepare() { return api }
prepare() { return Promise.resolve(api) }
}

class DummyAction extends Action {
Expand Down Expand Up @@ -92,7 +92,7 @@ describe('Atlas: cross-component communication', () => {
class InternalService extends Service {
static internal = true

prepare() { return api }
prepare() { return Promise.resolve(api) }
}

class DummyAction extends Action {
Expand Down
2 changes: 1 addition & 1 deletion packages/aws/src/service.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AWS extends Service {
aws[service] = new AWSService(config)
}

return aws
return Promise.resolve(aws)
}

stop() {
Expand Down
2 changes: 1 addition & 1 deletion packages/mongoose/src/service.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Mongoose extends Service {
// Add a trace logger to allow users to monitor Mongoose activity
instance.set('debug', this::mtrace)

return instance
return Promise.resolve(instance)
}

async start(instance) {
Expand Down
2 changes: 1 addition & 1 deletion packages/nodemailer/src/service.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Nodemailer extends Service {
// Attach a promisified version of the sendMail function
instance.send = instance::send

return instance
return Promise.resolve(instance)
}

async stop(instance) {
Expand Down
2 changes: 1 addition & 1 deletion packages/sequelize/src/service.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Sequelize extends Service {
// Add a trace logger to allow users to monitor Sequelize activity
this.config.options.logging = this::strace

return new Database(this.config.uri, this.config.options)
return Promise.resolve(new Database(this.config.uri, this.config.options))
}

async start(instance) {
Expand Down

0 comments on commit 2417929

Please sign in to comment.