Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions callBackPersistence.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ class CallBackPersistence extends EventEmitter {
}

set broker (broker) {
this.setup(broker)
}

setup (broker) {
if (this.ready) {
return
}
Expand All @@ -35,6 +31,10 @@ class CallBackPersistence extends EventEmitter {
})
}

setup (broker) {
return this.asyncPersistence.setup(broker)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering why our tests didn't catched this? Could you add one for this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you await setup() then it does not matter much to the calling function if the setup is async or not.
Only when you use .then() it matters. Aedes uses await , so to Aedes it does not matter. I only found it because aedes' test/will.js used setup() itself and was using .then.

Although it is technically speaking not a problem of setup() is not async I added the test to abstract.js so every persistence will be checked.

Kind regards,
Hans

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robertsLando
Btw: The index.d.ts only covers the callback signatures where the asyncPersistence.d.ts covers the async signatures.
We could add the async behaviour to index.d.ts but since Aedes is the only consumer of this code I don't think it is worth the effort to do so.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope no worries it's ok for now


subscriptionsByTopic (topic, cb) {
if (cb) {
if (!this.ready) {
Expand Down