Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2025-06-02 18:14:43 +05:00
parent 1b591e1e1f
commit 57e74375c5
No known key found for this signature in database
GPG Key ID: 211936D31001B31C
3 changed files with 4 additions and 4 deletions

View File

@ -53,7 +53,7 @@ export interface SessionData {
workspace: WorkspaceIds
socialStringsToUsers: Map<PersonId, AccountUuid>
asyncRequests?: (() => Promise<void>)[]
asyncRequests?: ((ctx: MeasureContext) => Promise<void>)[]
}
/**

View File

@ -179,7 +179,7 @@ export class TriggersMiddleware extends BaseMiddleware implements Middleware {
} else {
ctx.contextData.asyncRequests = [
...(ctx.contextData.asyncRequests ?? []),
async () => {
async (ctx) => {
// In case of async context, we execute both async and sync triggers as sync
await this.processAsyncTriggers(ctx, triggerControl, findAll, txes, triggers)
}

View File

@ -251,8 +251,8 @@ export class ClientSession implements Session {
onEnd = useReserveContext ? ctx.pipeline.context.adapterManager?.reserveContext?.(cid) : undefined
const handleAyncs = async (): Promise<void> => {
try {
for (const r of (ctx.ctx.contextData as SessionData).asyncRequests ?? []) {
await r()
for (const r of asyncs) {
await r(ctx.ctx)
}
} finally {
onEnd?.()