-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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: ensure that shutdown works in loaderOnly mode #6893
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Ignored Deployments
|
@@ -262,14 +264,13 @@ export class MedusaModule { | |||
let finishLoading: any | |||
let errorLoading: any | |||
|
|||
const loadingPromise = new Promise((resolve, reject) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are in an async function, can't we just return
or throw
instead of this pattern? I guess we want to allow others to be able to wait on a module to get loaded, it just feels like there is a better way to achieve it 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This prevents the same module being initialized multiple times while loading, like if you load it in a lambda handler and that is called multiple times in concurrency.
There isn't any other way to achieve this in a single process other than sharing a single Promise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
No description provided.