From ad47f7c1477780020631627514d3ef168e8f71ff Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Wed, 24 May 2017 10:42:47 +0300 Subject: [PATCH] throttling just prior to leaving hibernation, so as to allow re-throttle checks to apply --- go/base/context.go | 5 +++-- go/logic/throttler.go | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/go/base/context.go b/go/base/context.go index 357afab..d82b22e 100644 --- a/go/base/context.go +++ b/go/base/context.go @@ -40,8 +40,9 @@ const ( type ThrottleReasonHint string const ( - NoThrottleReasonHint ThrottleReasonHint = "NoThrottleReasonHint" - UserCommandThrottleReasonHint = "UserCommandThrottleReasonHint" + NoThrottleReasonHint ThrottleReasonHint = "NoThrottleReasonHint" + UserCommandThrottleReasonHint = "UserCommandThrottleReasonHint" + LeavingHibernationThrottleReasonHint = "LeavingHibernationThrottleReasonHint" ) const ( diff --git a/go/logic/throttler.go b/go/logic/throttler.go index 808fab4..8f21c0d 100644 --- a/go/logic/throttler.go +++ b/go/logic/throttler.go @@ -289,6 +289,7 @@ func (this *Throttler) collectGeneralThrottleMetrics() error { log.Errorf("critical-load met. Will hibernate for the duration of %+v, until %+v", hibernateDuration, hibernateUntilTime) go func() { time.Sleep(hibernateDuration) + this.migrationContext.SetThrottleGeneralCheckResult(base.NewThrottleCheckResult(true, "leaving hibernation", base.LeavingHibernationThrottleReasonHint)) atomic.StoreInt64(&this.migrationContext.HibernateUntil, 0) }() return nil