1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-01 02:30:39 +08:00

always obey the IPNS rebroadcast interval if it's smaller

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
This commit is contained in:
Steven Allen
2017-11-29 15:54:06 -08:00
parent fd2d63c5ba
commit 228c5552ab

View File

@ -65,6 +65,9 @@ func NewRepublisher(r routing.ValueStore, ds ds.Datastore, self ic.PrivKey, ks k
func (rp *Republisher) Run(proc goprocess.Process) {
timer := time.NewTimer(InitialRebroadcastDelay)
defer timer.Stop()
if rp.Interval < InitialRebroadcastDelay {
timer.Reset(rp.Interval)
}
for {
select {
@ -73,7 +76,9 @@ func (rp *Republisher) Run(proc goprocess.Process) {
err := rp.republishEntries(proc)
if err != nil {
log.Error("Republisher failed to republish: ", err)
timer.Reset(FailureRetryInterval)
if FailureRetryInterval < rp.Interval {
timer.Reset(FailureRetryInterval)
}
}
case <-proc.Closing():
return