Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Make sure the metrics goroutine is scheduled #335

Merged
merged 1 commit into from
Jul 3, 2020
Merged

Conversation

rumpl
Copy link
Contributor

@rumpl rumpl commented Jul 3, 2020

What I did

Wait for the goroutine to be scheduled before exiting. We don't wait for
the metrics event to be sent, we only make sure the goroutine is called.

Inpired by this change

// Fire and forget, we don't want to slow down the user waiting for DD
// metrics endpoint to respond. We could lose some events but that's ok.
go func() {
wasIn <- true
Copy link
Contributor

Choose a reason for hiding this comment

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

nit : I would have put this after the defer, this would theorically wait just slightly more, still without waiting for the http response. But in practice it probably does not make a difference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Wait for the goroutine to be scheduled before exiting. We don't wait for
the metrics event to be sent, we only make sure the goroutine is called.
@rumpl rumpl force-pushed the fix-metrics-goroutine branch from bf5c181 to 159b9d0 Compare July 3, 2020 12:58
@rumpl rumpl merged commit c4c0c24 into master Jul 3, 2020
@rumpl rumpl deleted the fix-metrics-goroutine branch July 3, 2020 13:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants