Try to fix missing communication broadcast events (#9384)

This commit is contained in:
Kristina
2025-06-29 18:24:20 +07:00
committed by GitHub
parent 47f7e107f2
commit 7cf2fe2041
9 changed files with 65 additions and 33 deletions
+10 -3
View File
@@ -388,6 +388,12 @@ export class ClientSession implements Session {
// We need to broadcast all collected transactions
const broadcastPromise = ctx.pipeline.handleBroadcast(ctx.ctx)
await broadcastPromise
ctx.ctx.contextData.broadcast.queue = []
ctx.ctx.contextData.broadcast.txes = []
ctx.ctx.contextData.broadcast.sessions = {}
// ok we could perform async requests if any
const asyncs = (ctx.ctx.contextData as SessionData).asyncRequests ?? []
let asyncsPromise: Promise<void> | undefined
@@ -403,13 +409,14 @@ export class ClientSession implements Session {
}
asyncsPromise = handleAyncs()
}
await broadcastPromise
if (asyncsPromise !== undefined) {
await asyncsPromise
await ctx.pipeline?.handleBroadcast(ctx.ctx)
}
} catch (err) {
await ctx.sendError(ctx.requestId, 'Failed to findAll', unknownError(err))
ctx.ctx.error('failed to findAll', { err })
await ctx.sendError(ctx.requestId, 'Failed to domainRequest', unknownError(err))
ctx.ctx.error('failed to domainRequest', { err })
}
}