mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-01-26 03:52:03 +02:00
otlptracegrpc: Shutdown returns context error (#3990)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
parent
b24bcc1fc8
commit
eb2b89f335
@ -130,13 +130,16 @@ var errAlreadyStopped = errors.New("the client is already stopped")
|
||||
// If the client has already stopped, an error will be returned describing
|
||||
// this.
|
||||
func (c *client) Stop(ctx context.Context) error {
|
||||
// Make sure to return context error if the context is done when calling this method.
|
||||
err := ctx.Err()
|
||||
|
||||
// Acquire the c.tscMu lock within the ctx lifetime.
|
||||
acquired := make(chan struct{})
|
||||
go func() {
|
||||
c.tscMu.Lock()
|
||||
close(acquired)
|
||||
}()
|
||||
var err error
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
// The Stop timeout is reached. Kill any remaining exports to force
|
||||
|
Loading…
x
Reference in New Issue
Block a user