throttling just prior to leaving hibernation, so as to allow re-throttle checks to apply

This commit is contained in:
Shlomi Noach 2017-05-24 10:42:47 +03:00
parent 3955a6d67f
commit ad47f7c147
2 changed files with 4 additions and 2 deletions

View File

@ -40,8 +40,9 @@ const (
type ThrottleReasonHint string type ThrottleReasonHint string
const ( const (
NoThrottleReasonHint ThrottleReasonHint = "NoThrottleReasonHint" NoThrottleReasonHint ThrottleReasonHint = "NoThrottleReasonHint"
UserCommandThrottleReasonHint = "UserCommandThrottleReasonHint" UserCommandThrottleReasonHint = "UserCommandThrottleReasonHint"
LeavingHibernationThrottleReasonHint = "LeavingHibernationThrottleReasonHint"
) )
const ( const (

View File

@ -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) log.Errorf("critical-load met. Will hibernate for the duration of %+v, until %+v", hibernateDuration, hibernateUntilTime)
go func() { go func() {
time.Sleep(hibernateDuration) time.Sleep(hibernateDuration)
this.migrationContext.SetThrottleGeneralCheckResult(base.NewThrottleCheckResult(true, "leaving hibernation", base.LeavingHibernationThrottleReasonHint))
atomic.StoreInt64(&this.migrationContext.HibernateUntil, 0) atomic.StoreInt64(&this.migrationContext.HibernateUntil, 0)
}() }()
return nil return nil