chore: Ensure Redis connection is ready with callback (#6924)

* chore(workflow-engine-redis): await for the connection callback

* cleanup

* cleanup

* Create early-rice-marry.md

* cleanup
This commit is contained in:
Adrien de Peretti
2024-04-04 20:40:41 +02:00
committed by GitHub
parent 880bbbd4af
commit 12fcb655cd
3 changed files with 13 additions and 3 deletions

View File

@@ -0,0 +1,6 @@
---
"@medusajs/event-bus-redis": patch
"@medusajs/workflow-engine-redis": patch
---
Chore/workflow engine loader redis

View File

@@ -27,7 +27,9 @@ export default async ({
})
try {
await connection.connect()
await new Promise(async resolve => {
await connection.connect(resolve)
})
logger?.info(`Connection to Redis in module 'event-bus-redis' established`)
} catch (err) {
logger?.error(

View File

@@ -7,7 +7,7 @@ export default async ({
container,
logger,
options,
dataLoaderOnly
dataLoaderOnly,
}: LoaderOptions): Promise<void> => {
const {
url,
@@ -80,7 +80,9 @@ async function getConnection(url, redisOptions) {
...(redisOptions ?? {}),
})
await connection.connect()
await new Promise(async (resolve) => {
await connection.connect(resolve)
})
return connection
}