mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-22 00:13:52 +01:00
daemon: remove last traces of watchdog mechanism
This commit is contained in:
parent
c9b812570d
commit
5aefc47f71
@ -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)
|
||||
|
@ -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())
|
||||
}
|
Loading…
Reference in New Issue
Block a user