Skip to content
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

Reworked to catch broken promise chains #148

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

WesleyClements
Copy link

@WesleyClements WesleyClements commented Jun 8, 2022

To address the issue outlined in #74 and the original ticket in the koa repo, I've refactored the recursion implementation to make it easier to keep track of whether or not next hasn't resolved.
The fundamental thing I've done is to add a proxy for the next middleware that will note when the next dispatch call returns. If any given middleware calls next and resolves before it does we throw an error. Additionally I've stripped out all of the safeguards in production to slim the implementation even more.
In production it won't be dissimilar to how things are already implemented. In development though, there will be an increase in memory footprint as, in addition to more variables, there will be an extra stack frame per middleware.

@codecov
Copy link

codecov bot commented Jun 8, 2022

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (bff06e9) 100.00% compared to head (a4a8208) 100.00%.

❗ Current head a4a8208 differs from pull request most recent head bd4772c. Consider uploading reports for the commit bd4772c to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #148   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           17        33   +16     
  Branches         5        13    +8     
=========================================
+ Hits            17        33   +16     
Impacted Files Coverage Δ
index.js 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@WesleyClements WesleyClements force-pushed the account-for-disconnected-promise-chain branch 3 times, most recently from f2ba5be to a90ad3a Compare June 9, 2022 15:55
WesleyClements and others added 2 commits April 8, 2023 21:55
Co-authored-by: François <rulliere.francois@gmail.com>
build(deps): bump minimatch from 3.0.4 to 3.1.2 (koajs#164)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants