Ensure executionDidEnd hooks are only called once#6846
Conversation
✅ Deploy Preview for apollo-server-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit dd3270c:
|
ec03efc to
dd3270c
Compare
|
Great, and this error will now get sent to unexpectedErrorProcessingRequest instead, right? |
|
@glasser right. I forgot we added that hook but probably would've been a good addition to this test. We do still see that code path exercised via the logger call and error that's thrown. Maybe we just want a few tests for that hook? |
|
Oops, probably should just have approved rather than merged — good call that more hook tests would be better. |
|
No worries, opened an issue for myself when I'm back |
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to version-4, this PR will be updated.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ `version-4` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `version-4`.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ # Releases ## @apollo/[email protected] ### Patch Changes - Updated dependencies \[[`3320fee92`](3320fee), [`9fc23f799`](9fc23f7), [`2cab8f785`](2cab8f7)]: - @apollo/[email protected] ## @apollo/[email protected] ### Patch Changes - [#6841](#6841) [`3320fee92`](3320fee) Thanks [@glasser](https://github.com/glasser)! - Upgrade @apollo/server-gateway-interface to have laxer definition of overallCachePolicy. - [#6731](#6731) [`9fc23f799`](9fc23f7) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Use extensions for all imports to accommodate TS users using moduleResolution: "nodenext" - [#6846](#6846) [`2cab8f785`](2cab8f7) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Ensure executionDidEnd hooks are only called once (when they throw) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Reproduction in first commit, resolution with test updates in second commit.
executionDidEndhooks are currently called within both the try and catch clauses of the same block. This means that if a hook throws, they'll be called again in the catch.Similar to changes made for
parsingDidEndin #6679, we now call theexecutionDidEndhooks after the try/catch and within the catch. This ensures they'll only ever be called once.Fixes #6567