Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
bc712422
Unverified
Commit
bc712422
authored
Dec 01, 2017
by
Whyrusleeping
Committed by
GitHub
Dec 01, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4440 from ipfs/fix/ipns-repub
Fix various IPNS issues
parents
abe8ced8
228c5552
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
docs/config.md
docs/config.md
+1
-1
namesys/republisher/repub.go
namesys/republisher/repub.go
+18
-3
No files found.
docs/config.md
View file @
bc712422
...
...
@@ -208,7 +208,7 @@ The base64 encoded protobuf describing (and containing) the nodes private key.
-
`RepublishPeriod`
A time duration specifying how frequently to republish ipns records to ensure
they stay fresh on the network. If unset, we default to
12
hours.
they stay fresh on the network. If unset, we default to
4
hours.
-
`RecordLifetime`
A time duration specifying the value to set on ipns records for their validity
...
...
namesys/republisher/repub.go
View file @
bc712422
...
...
@@ -26,8 +26,16 @@ var errNoEntry = errors.New("no previous entry")
var
log
=
logging
.
Logger
(
"ipns-repub"
)
// DefaultRebroadcastInterval is the default interval at which we rebroadcast IPNS records
var
DefaultRebroadcastInterval
=
time
.
Hour
*
4
// InitialRebroadcastDelay is the delay before first broadcasting IPNS records on start
var
InitialRebroadcastDelay
=
time
.
Minute
*
1
// FailureRetryInterval is the interval at which we retry IPNS records broadcasts (when they fail)
var
FailureRetryInterval
=
time
.
Minute
*
5
// DefaultRecordLifetime is the default lifetime for IPNS records
const
DefaultRecordLifetime
=
time
.
Hour
*
24
type
Republisher
struct
{
...
...
@@ -55,15 +63,22 @@ 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
()
timer
:=
time
.
NewTimer
(
InitialRebroadcastDelay
)
defer
timer
.
Stop
()
if
rp
.
Interval
<
InitialRebroadcastDelay
{
timer
.
Reset
(
rp
.
Interval
)
}
for
{
select
{
case
<-
tick
.
C
:
case
<-
timer
.
C
:
timer
.
Reset
(
rp
.
Interval
)
err
:=
rp
.
republishEntries
(
proc
)
if
err
!=
nil
{
log
.
Error
(
"Republisher failed to republish: "
,
err
)
if
FailureRetryInterval
<
rp
.
Interval
{
timer
.
Reset
(
FailureRetryInterval
)
}
}
case
<-
proc
.
Closing
()
:
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment