docs: improvements + additions to module docs (#9152)
- Split Module and Module Links to their own chapters - Add new docs on db operations and transactions in modules, multiple services, links with custom columns, etc... - Added a list of registered dependencies in a module container
This commit is contained in:
@@ -8,7 +8,13 @@ This chapter lists constraints to keep in mind when creating a service.
|
||||
|
||||
## Use Async Methods
|
||||
|
||||
Medusa wraps adds wrappers around your service's methods and executes them as async methods.
|
||||
Medusa wraps service method executions to inject useful context or transactions. However, since Medusa can't detect whether the method is asynchronus, it always executes methods in the wrapper with the `await` keyword.
|
||||
|
||||
For example, if you have a synchronous `getMessage` method, and you use it other resources like workflows, Medusa executes it as an async method:
|
||||
|
||||
```ts
|
||||
await helloModuleService.getMessage()
|
||||
```
|
||||
|
||||
So, make sure your service's methods are always async to avoid unexpected errors or behavior.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user