Don't report a context cancelation as an error
This commit is contained in:
parent
20ece60a72
commit
34349d4b48
|
@ -70,7 +70,12 @@ func (e *Environment) Attach() error {
|
||||||
// indicates that the container is no longer running.
|
// indicates that the container is no longer running.
|
||||||
go func(ctx context.Context) {
|
go func(ctx context.Context) {
|
||||||
if err := e.pollResources(ctx); err != nil {
|
if err := e.pollResources(ctx); err != nil {
|
||||||
log.WithField("environment_id", e.Id).WithField("error", errors.WithStackIf(err)).Error("error during environment resource polling")
|
l := log.WithField("environment_id", e.Id)
|
||||||
|
if !errors.Is(err, context.Canceled) {
|
||||||
|
l.WithField("error", errors.WithStackIf(err)).Error("error during environment resource polling")
|
||||||
|
} else {
|
||||||
|
l.Warn("stopping server resource polling: context canceled")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}(ctx)
|
}(ctx)
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ func (e *Environment) pollResources(ctx context.Context) error {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return ctx.Err()
|
return errors.WithStackIf(ctx.Err())
|
||||||
default:
|
default:
|
||||||
var v *types.StatsJSON
|
var v *types.StatsJSON
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user