@@ -2,6 +2,7 @@ package agent
2
2
3
3
import (
4
4
"context"
5
+ "errors"
5
6
"sync"
6
7
7
8
"github.com/moby/swarmkit/v2/agent/exec"
@@ -239,15 +240,15 @@ func reconcileTaskState(ctx context.Context, w *worker, assignments []*api.Assig
239
240
}
240
241
241
242
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 ) {
243
244
log .G (ctx ).WithError (err ).Error ("failed updating assigned task" )
244
245
}
245
246
} else {
246
247
// we may have still seen the task, let's grab the status from
247
248
// storage and replace it with our status, if we have it.
248
249
status , err := GetTaskStatus (tx , task .ID )
249
250
if err != nil {
250
- if err != errTaskUnknown {
251
+ if ! errors . Is ( err , errTaskUnknown ) {
251
252
return err
252
253
}
253
254
@@ -569,7 +570,7 @@ func (w *worker) updateTaskStatus(ctx context.Context, tx *bolt.Tx, taskID strin
569
570
// dance of too-tightly-coupled concurrent parts, fixing tht race is
570
571
// fraught with hazards. instead, we'll recognize that it can occur,
571
572
// log the error, and then ignore it.
572
- if err == errTaskUnknown {
573
+ if errors . Is ( err , errTaskUnknown ) {
573
574
// log at info level. debug logging in docker is already really
574
575
// verbose, so many people disable it. the race that causes this
575
576
// behavior should be very rare, but if it occurs, we should know
0 commit comments