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: server request event retention during async handling #5905

Merged
merged 17 commits into from
Feb 29, 2024

Conversation

wmertens
Copy link
Member

fixes #4417

This passes one test already, but it needs to use a global to communicate between the qwik-city middleware and the qwik-city server functions, so it's not ideal.

Copy link

netlify bot commented Feb 28, 2024

👷 Deploy request for qwik-insights pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 9bcd007

@wmertens wmertens changed the title wip fix: server request event retention during async handling Feb 28, 2024
Copy link
Contributor

@mhevery mhevery left a comment

Choose a reason for hiding this comment

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

Yes, this is the approach which we have discussed.

@PatrickJS PatrickJS marked this pull request as ready for review February 29, 2024 01:37
@PatrickJS
Copy link
Member

I'm updating the tests

Copy link
Contributor

@mhevery mhevery left a comment

Choose a reason for hiding this comment

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

Minor comments, LGTM otherwise.

@PatrickJS PatrickJS merged commit 63a1aed into QwikDev:main Feb 29, 2024
22 checks passed
@@ -27,6 +27,12 @@ import type { QwikManifest, ResolvedManifest } from '@builder.io/qwik/optimizer'
import { IsQData, QDATA_JSON, QDATA_JSON_LEN } from './user-response';
import { isPromise } from './../../runtime/src/utils';

// TODO: create single QGlobal type
type AsyncStore = import('node:async_hooks').AsyncLocalStorage<RequestEventInternal>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you doing a dynamic import here? Why not just regular static import? See https://developers.cloudflare.com/workers/runtime-apis/nodejs/asynclocalstorage/

Copy link
Member Author

@wmertens wmertens Feb 29, 2024

Choose a reason for hiding this comment

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

Because if it's running somewhere without ALS, it can behave as before. Presumably this type import doesn't crash then.

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.

[🐞] this is undefined in server$ function when called consequentially.
3 participants