"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "components/engine/vendor/github.com/docker/swarmkit/manager/orchestrator/service.go" between
docker-ce-19.03.2.tar.gz and docker-ce-19.03.3.tar.gz

About: Docker CE is a project to pack, ship and run any application as a lightweight container. Docker containers can run anywhere, on a laptop or at scale, in production, on VMs, bare metal, OpenStack clusters, public clouds and more. Community edition.

service.go  (docker-ce-19.03.2):service.go  (docker-ce-19.03.3)
skipping to change at line 50 skipping to change at line 50
tasks, err = store.FindTasks(tx, store.ByServiceID(service.ID)) tasks, err = store.FindTasks(tx, store.ByServiceID(service.ID))
}) })
if err != nil { if err != nil {
log.G(ctx).WithError(err).Errorf("failed to list tasks") log.G(ctx).WithError(err).Errorf("failed to list tasks")
return return
} }
err = s.Batch(func(batch *store.Batch) error { err = s.Batch(func(batch *store.Batch) error {
for _, t := range tasks { for _, t := range tasks {
err := batch.Update(func(tx store.Tx) error { err := batch.Update(func(tx store.Tx) error {
// the task may have changed for some reason in t
he meantime
// since we read it out, so we need to get from t
he store again
// within the boundaries of a transaction
latestTask := store.GetTask(tx, t.ID)
// time travel is not allowed. if the current des ired state is // time travel is not allowed. if the current des ired state is
// above the one we're trying to go to we can't g o backwards. // above the one we're trying to go to we can't g o backwards.
// we have nothing to do and we should skip to th e next task // we have nothing to do and we should skip to th e next task
if t.DesiredState > api.TaskStateRemove { if latestTask.DesiredState > api.TaskStateRemove {
// log a warning, though. we shouln't be trying to rewrite // log a warning, though. we shouln't be trying to rewrite
// a state to an earlier state // a state to an earlier state
log.G(ctx).Warnf( log.G(ctx).Warnf(
"cannot update task %v in desired state %v to an earlier desired state %v", "cannot update task %v in desired state %v to an earlier desired state %v",
t.ID, t.DesiredState, api.TaskSta teRemove, latestTask.ID, latestTask.Desired State, api.TaskStateRemove,
) )
return nil return nil
} }
// update desired state to REMOVE // update desired state to REMOVE
t.DesiredState = api.TaskStateRemove latestTask.DesiredState = api.TaskStateRemove
if err := store.UpdateTask(tx, t); err != nil { if err := store.UpdateTask(tx, latestTask); err ! = nil {
log.G(ctx).WithError(err).Errorf("failed transaction: update task desired state to REMOVE") log.G(ctx).WithError(err).Errorf("failed transaction: update task desired state to REMOVE")
} }
return nil return nil
}) })
if err != nil { if err != nil {
return err return err
} }
} }
return nil return nil
}) })
 End of changes. 5 change blocks. 
4 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)