Skip to content

Commit

Permalink
Do log "Setting weight to <VALUE>" on the final step, where VALUE=100
Browse files Browse the repository at this point in the history
  • Loading branch information
mumoshu committed Sep 11, 2020
1 parent 01633c0 commit ffe623b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
11 changes: 5 additions & 6 deletions pkg/courier/route53_record_set_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,7 @@ func (r *Route53RecordSetRouter) TrafficShift(ctx context.Context) error {
select {
case <-ticker.C:
if p >= 100 {
fmt.Printf("Done.")
p = 100

if err := rp.Update(100); err != nil {
return err
}
return nil
}

log.Printf("Setting weight to %v", p)
Expand All @@ -90,6 +84,11 @@ func (r *Route53RecordSetRouter) TrafficShift(ctx context.Context) error {
return err
}

if p == 100 {
fmt.Printf("Done.")
return nil
}

p += step
case <-ctx.Done():
if p != 100 {
Expand Down
11 changes: 5 additions & 6 deletions pkg/courier/traffic_shift.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,7 @@ func DoGradualTrafficShift(ctx context.Context, svc elbv2iface.ELBV2API, l Liste
select {
case <-ticker.C:
if p >= 100 {
fmt.Printf("Done.")
p = 100

if err := SetDesiredTGTrafficPercentage(svc, l, 100); err != nil {
return err
}
return nil
}

log.Printf("Setting weight to %v", p)
Expand All @@ -57,6 +51,11 @@ func DoGradualTrafficShift(ctx context.Context, svc elbv2iface.ELBV2API, l Liste
return err
}

if p == 100 {
fmt.Printf("Done.")
return nil
}

p += step
case <-ctx.Done():
if p != 100 {
Expand Down

0 comments on commit ffe623b

Please sign in to comment.