bugsnag / bugsnag-go

Automatic panic monitoring for Go and Go web frameworks, like negroni, gin, and revel
https://docs.bugsnag.com/platforms/go
MIT License
204 stars 69 forks source link

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

Closed DariaKunoichi closed 2 months ago

DariaKunoichi commented 3 months ago

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