Fix #355 - processMiddleware doesn't wait for last global middleware's call to next()#394
Conversation
Codecov Report
@@ Coverage Diff @@
## master #394 +/- ##
=======================================
Coverage 81.33% 81.33%
=======================================
Files 7 7
Lines 525 525
Branches 150 150
=======================================
Hits 427 427
Misses 70 70
Partials 28 28Continue to review full report at Codecov.
|
I'd like to eliminate this 2% drop. I'll make a pull request to your branch. |
hmm, it's a bit weird but now it seems to be fine. Looks ready to merge anyways. @aoberoi @stevengill I'd like to merge this PR tomorrow in my local time. Take a look at this when you have a chance until then. |
|
@seratch That is weird. I couldn't figure out how coverage had dropped after I merged latest master. Thanks for looking! |
|
Let me merge this now. |
|
@seratch @stevengill I was just thinking that if folks using bolt upgrade to a release with this fix and had custom global middleware that incorrectly relied on this behavior (specifically, that didn't call |
|
@artgillespie I think communication can be like this.
Probably, the English sentence can be polished by others, but I think we should have the above message in the release note and the document in English/Japanese. Any thoughts? @stevengill @aoberoi @shaydewael |
Summary
This provides a test case for #355 (see src/middleware/process.spec.ts) as well as a proposed fix.
What I think is happening is that for the last global middleware,
processMiddlewareis passing a noop next function and calling next on the next process tick. This leads to unexpected results when the last (or only) global middleware is async, as is the case if you implement a conversation store as outlined hereI had to update a couple global middleware implementations in App.spec.ts that were relying on this behavior and not calling
next().Requirements (place an
xin each[ ])