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

Change async event delivery to single goroutine with events channel queue #231

Merged
merged 2 commits into from
Aug 5, 2024

Conversation

DariaKunoichi
Copy link
Contributor

@DariaKunoichi DariaKunoichi commented Jul 23, 2024

Goal

In case of heavy load notifier created too many goroutines for sending events thus consuming a lot of resources.
Adding a single goroutine with a channel will limit usage of resources and allow events to get queued to be sent instead of trying to send everything at once.

Changeset

Added a single goroutine as a default strategy for the async delivery. On failure events are dropped.
Goroutine has two ways of handling graceful shutdown. Either react to a signal which it's registered to or react to main program context sending Done().
Added configuration option for passing MainProgramContext.

Testing

Existing maze-runner tests can be used

@DariaKunoichi DariaKunoichi self-assigned this Jul 23, 2024
@DariaKunoichi DariaKunoichi force-pushed the PLAT-12425 branch 2 times, most recently from bb817e2 to 3125968 Compare July 31, 2024 11:46
@DariaKunoichi DariaKunoichi changed the base branch from master to next July 31, 2024 12:26
v2/report_publisher.go Outdated Show resolved Hide resolved
v2/report_publisher.go Outdated Show resolved Hide resolved
v2/report_publisher.go Outdated Show resolved Hide resolved
v2/report_publisher.go Show resolved Hide resolved
@DariaKunoichi DariaKunoichi requested a review from kstenerud August 2, 2024 08:41
@DariaKunoichi DariaKunoichi marked this pull request as ready for review August 2, 2024 08:41
v2/report_publisher.go Show resolved Hide resolved
v2/report_publisher.go Show resolved Hide resolved
@DariaKunoichi DariaKunoichi changed the title Add configurable goroutine pooler for asynchronous event delivery Change async event delivery to single goroutine with events channel queue Aug 5, 2024
@DariaKunoichi DariaKunoichi merged commit c7a0901 into next Aug 5, 2024
29 of 53 checks passed
@DariaKunoichi DariaKunoichi deleted the PLAT-12425 branch August 5, 2024 10:53
@DariaKunoichi DariaKunoichi mentioned this pull request Aug 27, 2024
DariaKunoichi added a commit that referenced this pull request Aug 27, 2024
## 2.5.0 (2024-08-27)

### Enhancements

* Limit resource usage while sending events asynchronously \
  Added MainContext configuration option for providing context from main app
  [#231](#231)
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