feat: v2 - add worker mode (#6739)
**What** - Adds support for starting a Medusa process with a worker mode. - The worker modes supported are "shared", "worker", "server" - In "worker" mode, API routes are not registered and modules that need to run workers (e.g., event bus redis) can use the flag to conditionally start workers. - In "server" mode, API routes are registered and workers are not started. - In "shared" mode, API routes are registered and workers are started. This is great for development.
This commit is contained in:
@@ -485,6 +485,25 @@ export type ProjectConfigOptions = {
|
||||
* ```
|
||||
*/
|
||||
jobs_batch_size?: number
|
||||
|
||||
/**
|
||||
* Configure the application's worker mode. The default value is `shared`.
|
||||
* - Use `shared` if you want to run the application in a single process.
|
||||
* - Use `worker` if you want to run the a worker process only.
|
||||
* - Use `server` if you want to run the application server only.
|
||||
*
|
||||
* @example
|
||||
* ```js title="medusa-config.js"
|
||||
* module.exports = {
|
||||
* projectConfig: {
|
||||
* worker_mode: "shared"
|
||||
* // ...
|
||||
* },
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
worker_mode?: "shared" | "worker" | "server"
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,6 +48,7 @@ export type InternalModuleDeclaration = {
|
||||
* If the module is the main module for the key when multiple ones are registered
|
||||
*/
|
||||
main?: boolean
|
||||
worker_mode?: "shared" | "worker" | "server"
|
||||
}
|
||||
|
||||
export type ExternalModuleDeclaration = {
|
||||
|
||||
Reference in New Issue
Block a user