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

fix(cache): remove rejected cache promise from pending list. #995

Merged
merged 7 commits into from
Mar 6, 2023

Conversation

tdekoning
Copy link
Contributor

πŸ”— Linked issue

nuxt/nuxt#18926

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Resolved nuxt/nuxt#18926.

Cached events that have rejected were kept inside the pending list, causing later requests to the same event to reject as well. This led to events on the same path to never recover, because the code of the event was never called again after an error.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe requested a review from pi0 February 24, 2023 14:01
@codecov
Copy link

codecov bot commented Feb 24, 2023

Codecov Report

Merging #995 (fa2fd44) into main (f78619f) will increase coverage by 0.06%.
The diff coverage is n/a.

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

@@            Coverage Diff             @@
##             main     #995      +/-   ##
==========================================
+ Coverage   67.67%   67.73%   +0.06%     
==========================================
  Files          61       60       -1     
  Lines        6171     6133      -38     
  Branches      694      691       -3     
==========================================
- Hits         4176     4154      -22     
+ Misses       1985     1969      -16     
  Partials       10       10              
Impacted Files Coverage Ξ”
src/presets/lagon.ts 30.95% <0.00%> (-4.77%) ⬇️
src/rollup/plugins/esbuild.ts 53.33% <0.00%> (-1.08%) ⬇️
src/rollup/config.ts 87.44% <0.00%> (-0.89%) ⬇️
src/rollup/plugins/storage.ts 98.66% <0.00%> (-0.10%) ⬇️
src/types/fetch.ts 100.00% <0.00%> (ΓΈ)
src/presets/index.ts 100.00% <0.00%> (ΓΈ)
src/presets/cloudflare-pages.ts
src/build.ts 46.07% <0.00%> (+1.44%) ⬆️
src/presets/cloudflare.ts 87.17% <0.00%> (+7.17%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@tdekoning
Copy link
Contributor Author

@pi0 do you have time to review this change? It seems to me as quite a small fix for a very impactful problem.

}
} catch (error) {
// Make sure entries that reject get removed.
delete pending[key];
Copy link
Member

Choose a reason for hiding this comment

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

I think we could limit scope of try catch around L94 only.

@pi0
Copy link
Member

pi0 commented Mar 6, 2023

Thanks for the PR dear @tdekoning and sorry took long to review.

@pi0 pi0 merged commit a5c5a48 into nitrojs:main Mar 6, 2023
@pi0 pi0 changed the title fix: remove rejected cache promise from pending list. fix(cache): remove rejected cache promise from pending list. Mar 6, 2023
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.

Nuxt application broken after any error occurred if using cache configuration
4 participants