daemon: remove last traces of watchdog mechanism

This commit is contained in:
Christian Schwarz 2019-03-19 18:15:34 +01:00
parent c9b812570d
commit 5aefc47f71
2 changed files with 0 additions and 41 deletions

View File

@ -10,7 +10,6 @@ import (
"github.com/zrepl/zrepl/pruning"
"github.com/zrepl/zrepl/replication/logic/pdu"
"github.com/zrepl/zrepl/util/envconst"
"github.com/zrepl/zrepl/util/watchdog"
"sort"
"strings"
"sync"
@ -60,8 +59,6 @@ type args struct {
type Pruner struct {
args args
Progress watchdog.KeepAlive
mtx sync.RWMutex
state State
@ -319,10 +316,6 @@ func (s snapshot) Date() time.Time { return s.date }
func doOneAttempt(a *args, u updater) {
ctx, target, receiver := a.ctx, a.target, a.receiver
var ka *watchdog.KeepAlive
u(func(pruner *Pruner) {
ka = &pruner.Progress
})
sfssres, err := receiver.ListFilesystems(ctx, &pdu.ListFilesystemReq{})
if err != nil {
@ -397,7 +390,6 @@ tfss_loop:
pfsPlanErrAndLog(err, "cannot get replication cursor bookmark")
continue tfss_loop
}
ka.MadeProgress()
if rc.GetNotexist() {
err := errors.New("replication cursor bookmark does not exist (one successful replication is required before pruning works)")
pfsPlanErrAndLog(err, "")
@ -445,11 +437,9 @@ tfss_loop:
// Apply prune rules
pfs.destroyList = pruning.PruneSnapshots(pfs.snaps, a.rules)
ka.MadeProgress()
}
u(func(pruner *Pruner) {
pruner.Progress.MadeProgress()
pruner.execQueue = newExecQueue(len(pfss))
for _, pfs := range pfss {
pruner.execQueue.Put(pfs, nil, false)

View File

@ -1,31 +0,0 @@
package watchdog
import (
"fmt"
"sync"
"time"
)
type KeepAlive struct {
mtx sync.Mutex
lastUpd time.Time
}
func (p *KeepAlive) String() string {
if p.lastUpd.IsZero() {
return fmt.Sprintf("never updated")
}
return fmt.Sprintf("last update at %s", p.lastUpd)
}
func (k *KeepAlive) MadeProgress() {
k.mtx.Lock()
defer k.mtx.Unlock()
k.lastUpd = time.Now()
}
func (k *KeepAlive) CheckTimeout(timeout time.Duration, jitter time.Duration) (didTimeOut bool) {
k.mtx.Lock()
defer k.mtx.Unlock()
return k.lastUpd.Add(timeout - jitter).Before(time.Now())
}