-
-
Notifications
You must be signed in to change notification settings - Fork 585
go/libraries/events: Restructure events collection so that we can send events while the dolt process is running. #7468
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
Conversation
…d events while the dolt process is running. We make the GlobalCollector mutable. We give the Collector a sendingThread which can have an Emitter. When the Collector collects enough events, it forwards a batch of them to the sendingThread. If the sendingThread has an Emitter, it attempts to send its current batch on that Emitter. On shutdown, contexts get canceled, background threads get waited on, and then an accumulated un-emitted events are returned from the Collector, same as previously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
go/libraries/events/collector.go
Outdated
| } | ||
|
|
||
| const collChanBufferSize = 32 | ||
| const maxBatchedEvents = 1024 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to set this so high? Seems like less bursty would be better
| cancelF func() | ||
|
|
||
| batchCh chan []*eventsapi.ClientEvent | ||
| unsent []*eventsapi.ClientEvent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this is actually a local var?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost. Returned from stop() for any un-emitted things.
|
@coffeegoddd DOLT
|
We make the GlobalCollector mutable.
We give the Collector a sendingThread which can have an Emitter. When the Collector collects enough events, it forwards a batch of them to the sendingThread. If the sendingThread has an Emitter, it attempts to send its current batch on that Emitter.
On shutdown, contexts get canceled, background threads get waited on, and then an accumulated un-emitted events are returned from the Collector, same as previously.