plugin/secondary: fix a bunch of things and tests (#1406)

Fix the error handling. Log when we have an error during any of the
transfer state. And if there isn't an error transfer the zones.

Also fix the tests in test/ so we, at least, check the initial transfer.

Update the docs to show more about how errors are handled.

Ref #1400
This commit is contained in:
Miek Gieben
2018-01-23 10:35:10 +00:00
committed by GitHub
parent 7d371edb2d
commit 85457cf50d
4 changed files with 62 additions and 146 deletions

View File

@@ -118,19 +118,6 @@ Restart:
retry := time.Second * time.Duration(z.Apex.SOA.Retry)
expire := time.Second * time.Duration(z.Apex.SOA.Expire)
if refresh < time.Hour {
refresh = time.Hour
}
if retry < time.Hour {
retry = time.Hour
}
if refresh > 24*time.Hour {
refresh = 24 * time.Hour
}
if retry > 12*time.Hour {
retry = 12 * time.Hour
}
refreshTicker := time.NewTicker(refresh)
retryTicker := time.NewTicker(retry)
expireTicker := time.NewTicker(expire)
@@ -151,7 +138,12 @@ Restart:
time.Sleep(jitter(2000)) // 2s randomize
ok, err := z.shouldTransfer()
if err != nil && ok {
if err != nil {
log.Printf("[WARNING] Failed retry check %s", err)
continue
}
if ok {
if err := z.TransferIn(); err != nil {
// transfer failed, leave retryActive true
break
@@ -169,8 +161,13 @@ Restart:
time.Sleep(jitter(5000)) // 5s randomize
ok, err := z.shouldTransfer()
retryActive = err != nil
if err != nil && ok {
if err != nil {
log.Printf("[WARNING] Failed refresh check %s", err)
retryActive = true
continue
}
if ok {
if err := z.TransferIn(); err != nil {
// transfer failed
retryActive = true