fix: check for non-zero cooldown period

Signed-off-by: Shiva Pentakota <spentakota@vmware.com>
This commit is contained in:
Shiva Pentakota 2023-03-22 20:46:24 -07:00
parent 711b72932a
commit 5c3fc2e477

View file

@ -187,8 +187,10 @@ func (sc *PollingShardConsumer) getRecords() error {
continue
}
if err == maxBytesExceededError {
log.Infof("maxBytesExceededError so sleep for %+v seconds", coolDownPeriod)
time.Sleep(time.Duration(coolDownPeriod) * time.Second)
if coolDownPeriod != 0 {
log.Infof("maxBytesExceededError so sleep for %+v seconds", coolDownPeriod)
time.Sleep(time.Duration(coolDownPeriod) * time.Second)
}
continue
}
if errors.As(err, &kmsThrottlingErr) {