-
Notifications
You must be signed in to change notification settings - Fork 31
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
Support for multiple dbos app files in NextJs App #700
base: main
Are you sure you want to change the base?
Conversation
@@ -45,7 +45,8 @@ class dbosWorkflowClass { | |||
// This code needs to execute at least once to launch the DBOS runtime | |||
// Do not delete this code | |||
if (process.env.NEXT_PHASE !== "phase-production-build") { | |||
await DBOS.launch(); | |||
await DBOS.register(dbosWorkflowClass); |
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.
Is there no longer any need for DBOS.launch()
?
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.
Not in NextJs. register calls launch.
But we do need to run the launch method once
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 is having classes registered after launch. This is guaranteed to not be 100% working at the moment...
@@ -147,9 +147,27 @@ export class DBOS { | |||
set(conf, key, newValue); | |||
} | |||
|
|||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |||
static async register(cls: any) { |
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.
How do this and launch relate? Does launch do things that this doesn't? When do you need both or just one?
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.
Register registers one class.
Launch intializes various things in the runtime like http, loggers, db connections etc. It does have some registration code that needs to be refactored out imho.
Launch needs to be called only once.
Register needs to be called once per file. Register calls launch because someone has to call launch but launch wll run only once
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.
Got it! And is it okay if launch
runs before all registers are done?
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.
Yes. Because we explicitly register again
I want time to finish exploring a different approach. |
"A different approach" == "the one on the chuck/next branch". |
No description provided.