prometheus
prometheus copied to clipboard
Why not make goroutine stoppable / cancellable?
Your Question
This library start multiple process without a way to stop them using the context.Context
and/or a Finalize()
/ Close()
function(s).
Are there any reasons? Could this be added?
The document you expected this should be explained
I would expect every loop with goroutine to support context done, like:
select {
case <-time.After(time.Duration(p.Config.RefreshInterval) * time.Second):
// LOGIC
case <-ctx.Done():
return
}
And for the server to store it and expose the Close function.
Expected answer
Hopefully yes and I or someone else can do it.