Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP-4870 async event handlers support #201

Merged
merged 28 commits into from
Sep 2, 2024

Conversation

CarlosGamero
Copy link
Collaborator

No description provided.

@CarlosGamero CarlosGamero self-assigned this Aug 28, 2024
@CarlosGamero CarlosGamero mentioned this pull request Aug 28, 2024
@CarlosGamero CarlosGamero marked this pull request as ready for review August 28, 2024 11:48
@CarlosGamero CarlosGamero marked this pull request as draft August 28, 2024 11:48
@CarlosGamero CarlosGamero marked this pull request as ready for review August 28, 2024 16:42
@CarlosGamero CarlosGamero requested a review from kibertoad August 28, 2024 16:42
@CarlosGamero CarlosGamero changed the title [IN PROGRESS] AP-4870 async event handlers support AP-4870 async event handlers support Aug 28, 2024
Comment on lines 44 to 48
CommonEventDefinitionPublisherSchemaType<CommonEventDefinition> = CommonEventDefinitionPublisherSchemaType<CommonEventDefinition>,
> = {
readonly eventHandlerId: string
handleEvent(event: EventDefinitionSchema): void | Promise<void>
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add this to be able to add observability on bg handlers

Comment on lines 184 to 190
// not sure if we should use startWithGroup or start, using group to group all handlers for the same event type
// should it be eventId + eventType or just eventType?
this.transactionObservabilityManager?.startWithGroup(
this.buildTransactionKey(event, handler),
transactionId,
event.type,
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please share your thoughts 🙏! If you agree I will remove the comment

@CarlosGamero CarlosGamero requested a review from kibertoad August 30, 2024 15:24
background: [],
}

const fgHandlers = [...eventHandlers.foreground, ...this.anyHandlers.foreground]
Copy link
Owner

@kibertoad kibertoad Sep 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems a bit wasteful to repopulate this on every event. can we do that after handler is attached instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed on Slack, for visibility:
To avoid creating this array with every event, we moved any handler to eventHandlerMap

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already done :D

const transactionId = randomUUID()
let isSuccessfull = false
try {
this.transactionObservabilityManager?.startWithGroup(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I'd say it makes sense to use startWithGroup here

@CarlosGamero CarlosGamero merged commit 3bf68be into main Sep 2, 2024
5 checks passed
@CarlosGamero CarlosGamero deleted the feat/AP-4870-async_event_handlers_support branch September 2, 2024 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants