From d8de88c4b606eca1683a366e099c41e6688f4b19 Mon Sep 17 00:00:00 2001
From: Steven Allen <steven@stebalien.com>
Date: Wed, 29 Nov 2017 15:22:00 -0800
Subject: [PATCH] publish ipns records on start

(after a delay of 1 minute)

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
---
 namesys/republisher/repub.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/namesys/republisher/repub.go b/namesys/republisher/repub.go
index 3ab382473..b7c864cbd 100644
--- a/namesys/republisher/repub.go
+++ b/namesys/republisher/repub.go
@@ -27,6 +27,7 @@ var errNoEntry = errors.New("no previous entry")
 var log = logging.Logger("ipns-repub")
 
 var DefaultRebroadcastInterval = time.Hour * 4
+var InitialRebroadcastDelay = time.Minute * 1
 
 const DefaultRecordLifetime = time.Hour * 24
 
@@ -57,10 +58,12 @@ func NewRepublisher(r routing.ValueStore, ds ds.Datastore, self ic.PrivKey, ks k
 func (rp *Republisher) Run(proc goprocess.Process) {
 	tick := time.NewTicker(rp.Interval)
 	defer tick.Stop()
+	delayCh := time.After(InitialRebroadcastDelay)
 
 	for {
 		select {
-		case <-tick.C:
+		case <-delayCh:
+			delayCh = tick.C
 			err := rp.republishEntries(proc)
 			if err != nil {
 				log.Error("Republisher failed to republish: ", err)
-- 
GitLab