mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
reprovider: add config option to set reprovide interval
License: MIT Signed-off-by: Jeromy <why@ipfs.io>
This commit is contained in:
parent
7276fd84b0
commit
ad488c6525
15
core/core.go
15
core/core.go
@ -169,7 +169,20 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
|
||||
}
|
||||
|
||||
n.Reprovider = rp.NewReprovider(n.Routing, n.Blockstore)
|
||||
go n.Reprovider.ProvideEvery(ctx, kReprovideFrequency)
|
||||
|
||||
if cfg.Reprovider.Interval != "0" {
|
||||
interval := kReprovideFrequency
|
||||
if cfg.Reprovider.Interval != "" {
|
||||
dur, err := time.ParseDuration(cfg.Reprovider.Interval)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
interval = dur
|
||||
}
|
||||
|
||||
go n.Reprovider.ProvideEvery(ctx, interval)
|
||||
}
|
||||
|
||||
// setup local discovery
|
||||
if do != nil {
|
||||
|
||||
@ -15,6 +15,7 @@ a running daemon do not read the config file at runtime.
|
||||
- [`Identity`](#identity)
|
||||
- [`Ipns`](#ipns)
|
||||
- [`Mounts`](#mounts)
|
||||
- [`ReproviderInterval`](#reproviderinterval)
|
||||
- [`SupernodeRouting`](#supernoderouting)
|
||||
- [`Swarm`](#swarm)
|
||||
- [`Tour`](#tour)
|
||||
@ -192,6 +193,9 @@ Mountpoint for `/ipns/`.
|
||||
- `FuseAllowOther`
|
||||
Sets the FUSE allow other option on the mountpoint.
|
||||
|
||||
## `ReproviderInterval`
|
||||
Sets the time between rounds of reproviding local content to the routing system. If unset, it defaults to 12 hours. If set to the value `"0"` it will disable content reproviding.
|
||||
|
||||
## `SupernodeRouting`
|
||||
Deprecated.
|
||||
|
||||
|
||||
@ -29,6 +29,8 @@ type Config struct {
|
||||
SupernodeRouting SupernodeClientConfig // local node's routing servers (if SupernodeRouting enabled)
|
||||
API API // local node's API settings
|
||||
Swarm SwarmConfig
|
||||
|
||||
Reprovider Reprovider
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@ -68,6 +68,9 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
|
||||
"Access-Control-Allow-Headers": []string{"X-Requested-With"},
|
||||
},
|
||||
},
|
||||
Reprovider: Reprovider{
|
||||
Interval: "12h",
|
||||
},
|
||||
}
|
||||
|
||||
return conf, nil
|
||||
|
||||
5
repo/config/reprovider.go
Normal file
5
repo/config/reprovider.go
Normal file
@ -0,0 +1,5 @@
|
||||
package config
|
||||
|
||||
type Reprovider struct {
|
||||
Interval string // Time period to reprovide locally stored objects to the network
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user