Skip to content

Commit

Permalink
Merge pull request #43 from stormcat24/hotfix/task_empty_error
Browse files Browse the repository at this point in the history
Fixed task empty error
  • Loading branch information
Akinori Yamada committed Nov 13, 2015
2 parents cc58816 + 6d44868 commit 68da5cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion operation/version.go
@@ -1,3 +1,3 @@
package operation

const Version string = "0.1.10"
const Version string = "0.1.11"
24 changes: 14 additions & 10 deletions service/service.go
Expand Up @@ -239,9 +239,10 @@ func (self *ServiceController) ApplyServicePlan(plan *ServiceUpdatePlan) error {
var nextDesiredCount int64
if add.KeepDesiredCount {
nextDesiredCount = *current.DesiredCount
logger.Main.Infof("Keep DesiredCount = %d at '%s'", nextDesiredCount, add.Name)
} else {
nextDesiredCount = add.DesiredCount
logger.Main.Infof("Keep DesiredCount = %d at '%s'", nextDesiredCount, add.Name)
logger.Main.Infof("Next DesiredCount = %d at '%s'", nextDesiredCount, add.Name)
}

svc, err := api.UpdateService(plan.Name, add.Name, nextDesiredCount, add.TaskDefinition)
Expand Down Expand Up @@ -278,17 +279,20 @@ func (self *ServiceController) ApplyServicePlan(plan *ServiceUpdatePlan) error {
}
}

dts, err := api.DescribeTasks(plan.Name, taskIds)
if err != nil {
return err
}
if len(taskIds) > 0 {
dts, err := api.DescribeTasks(plan.Name, taskIds)
if err != nil {
return err
}

for _, t := range dts.Tasks {
if *t.StartedBy == targetServiceId {
if _, err := api.StopTask(plan.Name, *t.TaskArn); err != nil {
return err
for _, t := range dts.Tasks {
if *t.StartedBy == targetServiceId {
if _, err := api.StopTask(plan.Name, *t.TaskArn); err != nil {
logger.Main.Warnf("Task '%s' is not found, so cannot stop.", *t.TaskArn)
} else {
logger.Main.Infof("Stopped Task '%s'", *t.TaskArn)
}
}
logger.Main.Infof("Stopped Task '%s'", *t.TaskArn)
}
}

Expand Down

0 comments on commit 68da5cd

Please sign in to comment.