Skip to content
Snippets Groups Projects
Commit 228c5552 authored by Steven Allen's avatar Steven Allen
Browse files

always obey the IPNS rebroadcast interval if it's smaller


License: MIT
Signed-off-by: default avatarSteven Allen <steven@stebalien.com>
parent fd2d63c5
Branches
Tags
No related merge requests found
...@@ -65,6 +65,9 @@ func NewRepublisher(r routing.ValueStore, ds ds.Datastore, self ic.PrivKey, ks k ...@@ -65,6 +65,9 @@ func NewRepublisher(r routing.ValueStore, ds ds.Datastore, self ic.PrivKey, ks k
func (rp *Republisher) Run(proc goprocess.Process) { func (rp *Republisher) Run(proc goprocess.Process) {
timer := time.NewTimer(InitialRebroadcastDelay) timer := time.NewTimer(InitialRebroadcastDelay)
defer timer.Stop() defer timer.Stop()
if rp.Interval < InitialRebroadcastDelay {
timer.Reset(rp.Interval)
}
for { for {
select { select {
...@@ -73,8 +76,10 @@ func (rp *Republisher) Run(proc goprocess.Process) { ...@@ -73,8 +76,10 @@ func (rp *Republisher) Run(proc goprocess.Process) {
err := rp.republishEntries(proc) err := rp.republishEntries(proc)
if err != nil { if err != nil {
log.Error("Republisher failed to republish: ", err) log.Error("Republisher failed to republish: ", err)
if FailureRetryInterval < rp.Interval {
timer.Reset(FailureRetryInterval) timer.Reset(FailureRetryInterval)
} }
}
case <-proc.Closing(): case <-proc.Closing():
return return
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment