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 workspace: WorkspaceIds
socialStringsToUsers: Map<PersonId, AccountUuid> 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 { } else {
ctx.contextData.asyncRequests = [ ctx.contextData.asyncRequests = [
...(ctx.contextData.asyncRequests ?? []), ...(ctx.contextData.asyncRequests ?? []),
async () => { async (ctx) => {
// In case of async context, we execute both async and sync triggers as sync // In case of async context, we execute both async and sync triggers as sync
await this.processAsyncTriggers(ctx, triggerControl, findAll, txes, triggers) 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 onEnd = useReserveContext ? ctx.pipeline.context.adapterManager?.reserveContext?.(cid) : undefined
const handleAyncs = async (): Promise<void> => { const handleAyncs = async (): Promise<void> => {
try { try {
for (const r of (ctx.ctx.contextData as SessionData).asyncRequests ?? []) { for (const r of asyncs) {
await r() await r(ctx.ctx)
} }
} finally { } finally {
onEnd?.() onEnd?.()