mirror of
https://github.com/standardnotes/server
synced 2026-07-14 00:01:54 -04:00
fix(domain-events-infra): handling async functions
This commit is contained in:
@@ -32,24 +32,13 @@ export class SQSXRayEventMessageHandler implements DomainEventMessageHandlerInte
|
||||
|
||||
this.logger.debug(`Received event: ${domainEvent.type}`)
|
||||
|
||||
const xRaySegment = new Segment(domainEvent.type)
|
||||
await captureAsyncFunc(domainEvent.type, async (subsegment?: Subsegment) => {
|
||||
await handler.handle(domainEvent)
|
||||
|
||||
if (domainEvent.meta.correlation.userIdentifierType === 'uuid') {
|
||||
xRaySegment.setUser(domainEvent.meta.correlation.userIdentifier)
|
||||
}
|
||||
|
||||
await captureAsyncFunc(
|
||||
`${handler.constructor.name}.handle}`,
|
||||
async (subsegment?: Subsegment) => {
|
||||
await handler.handle(domainEvent)
|
||||
|
||||
if (subsegment) {
|
||||
subsegment.close()
|
||||
}
|
||||
xRaySegment.close()
|
||||
},
|
||||
xRaySegment,
|
||||
)
|
||||
if (subsegment) {
|
||||
subsegment.close()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async handleError(error: Error): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user