-
-
Notifications
You must be signed in to change notification settings - Fork 23
fix: make setup() in callBackPersistence async #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I’ve noticed several regressions. Should we review all tests to ensure better coverage? |
If we can improve the functionality then I'm all for it! Kind regards, |
@gnought Could you be more specific? Of course in case of regressions we should add tests to cover this |
callBackPersistence.js
Outdated
setup (broker) { | ||
return this.asyncPersistence.setup(broker) | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
while migrating aedes to async persistence I noticed that the
setup()
call in callback persistence did not return a promise.This PR fixes that.
Kind regards,
Hans