mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-09 09:20:54 +00:00
Fix
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
1b591e1e1f
commit
57e74375c5
@ -53,7 +53,7 @@ export interface SessionData {
|
||||
workspace: WorkspaceIds
|
||||
socialStringsToUsers: Map<PersonId, AccountUuid>
|
||||
|
||||
asyncRequests?: (() => Promise<void>)[]
|
||||
asyncRequests?: ((ctx: MeasureContext) => Promise<void>)[]
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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?.()
|
||||
|
Loading…
Reference in New Issue
Block a user