From ffe623bced33b7dbbbcd2d6e09e4612ea165ec19 Mon Sep 17 00:00:00 2001 From: Yusuke Kuoka Date: Fri, 11 Sep 2020 09:52:40 +0900 Subject: [PATCH] Do log "Setting weight to " on the final step, where VALUE=100 --- pkg/courier/route53_record_set_router.go | 11 +++++------ pkg/courier/traffic_shift.go | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/pkg/courier/route53_record_set_router.go b/pkg/courier/route53_record_set_router.go index 751a90c..6e29745 100644 --- a/pkg/courier/route53_record_set_router.go +++ b/pkg/courier/route53_record_set_router.go @@ -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) @@ -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 { diff --git a/pkg/courier/traffic_shift.go b/pkg/courier/traffic_shift.go index 7782668..fd495ea 100644 --- a/pkg/courier/traffic_shift.go +++ b/pkg/courier/traffic_shift.go @@ -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) @@ -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 {