Skip to content

Commit

Permalink
fix: wait 2sec before NewTasksRunningWaiter (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
juri-t authored Oct 22, 2024
1 parent 8251f32 commit 5f25dc5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions run.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cage

import (
"context"
"time"

"github.com/apex/log"
"github.com/aws/aws-sdk-go-v2/aws"
Expand Down Expand Up @@ -46,6 +47,11 @@ func (c *cage) Run(ctx context.Context, input *types.RunInput) (*types.RunResult
return nil, err
}
taskArn := o.Tasks[0].TaskArn

// NOTE: https://github.com/loilo-inc/canarycage/issues/93
// wait for the task to be running
time.Sleep(2 * time.Second)

log.Infof("waiting for task '%s' to start...", *taskArn)
if err := ecs.NewTasksRunningWaiter(ecsCli).Wait(ctx, &ecs.DescribeTasksInput{
Cluster: &env.Cluster,
Expand Down
5 changes: 5 additions & 0 deletions task/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ func (c *common) waitForTaskRunning(ctx context.Context) error {
}
env := c.di.Get(key.Env).(*env.Envars)
ecsCli := c.di.Get(key.EcsCli).(awsiface.EcsClient)

// NOTE: https://github.com/loilo-inc/canarycage/issues/93
// wait for the task to be running
time.Sleep(2 * time.Second)

log.Infof("🥚 waiting for canary task '%s' is running...", *c.taskArn)
if err := ecs.NewTasksRunningWaiter(ecsCli).Wait(ctx, &ecs.DescribeTasksInput{
Cluster: &env.Cluster,
Expand Down

0 comments on commit 5f25dc5

Please sign in to comment.