@@ -2,6 +2,7 @@ package agent
22
33import (
44 "context"
5+ "errors"
56 "sync"
67
78 "github.com/moby/swarmkit/v2/agent/exec"
@@ -239,15 +240,15 @@ func reconcileTaskState(ctx context.Context, w *worker, assignments []*api.Assig
239240 }
240241
241242 if mgr , ok := w .taskManagers [task .ID ]; ok {
242- if err := mgr .Update (ctx , task ); err != nil && err != ErrClosed {
243+ if err := mgr .Update (ctx , task ); err != nil && ! errors . Is ( err , ErrClosed ) {
243244 log .G (ctx ).WithError (err ).Error ("failed updating assigned task" )
244245 }
245246 } else {
246247 // we may have still seen the task, let's grab the status from
247248 // storage and replace it with our status, if we have it.
248249 status , err := GetTaskStatus (tx , task .ID )
249250 if err != nil {
250- if err != errTaskUnknown {
251+ if ! errors . Is ( err , errTaskUnknown ) {
251252 return err
252253 }
253254
@@ -569,7 +570,7 @@ func (w *worker) updateTaskStatus(ctx context.Context, tx *bolt.Tx, taskID strin
569570 // dance of too-tightly-coupled concurrent parts, fixing tht race is
570571 // fraught with hazards. instead, we'll recognize that it can occur,
571572 // log the error, and then ignore it.
572- if err == errTaskUnknown {
573+ if errors . Is ( err , errTaskUnknown ) {
573574 // log at info level. debug logging in docker is already really
574575 // verbose, so many people disable it. the race that causes this
575576 // behavior should be very rare, but if it occurs, we should know
0 commit comments