mirror of https://github.com/status-im/go-waku.git
Use function to calculate duration in days
This commit is contained in:
parent
f561e217aa
commit
08c5c2303e
|
@ -144,10 +144,9 @@ func Execute(options Options) {
|
|||
}
|
||||
|
||||
if options.Store.Enable {
|
||||
maxDays := time.Hour * 24 * time.Duration(options.Store.RetentionMaxDays)
|
||||
nodeOpts = append(nodeOpts, node.WithWakuStoreAndLimits(options.Store.ShouldResume, maxDays, options.Store.RetentionMaxMessages))
|
||||
nodeOpts = append(nodeOpts, node.WithWakuStoreAndLimits(options.Store.ShouldResume, options.Store.RetentionMaxDaysDuration(), options.Store.RetentionMaxMessages))
|
||||
if options.UseDB {
|
||||
dbStore, err := persistence.NewDBStore(persistence.WithDB(db), persistence.WithRetentionPolicy(options.Store.RetentionMaxMessages, maxDays))
|
||||
dbStore, err := persistence.NewDBStore(persistence.WithDB(db), persistence.WithRetentionPolicy(options.Store.RetentionMaxMessages, options.Store.RetentionMaxDaysDuration()))
|
||||
failOnErr(err, "DBStore")
|
||||
nodeOpts = append(nodeOpts, node.WithMessageProvider(dbStore))
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package waku
|
||||
|
||||
import "time"
|
||||
|
||||
type RendezvousOptions struct {
|
||||
Enable bool `long:"rendezvous" description:"Enable rendezvous protocol for peer discovery"`
|
||||
Nodes []string `long:"rendezvous-node" description:"Multiaddr of a waku2 rendezvous node. Option may be repeated"`
|
||||
|
@ -43,6 +45,10 @@ type StoreOptions struct {
|
|||
Nodes []string `long:"store-node" description:"Multiaddr of a peer that supports store protocol. Option may be repeated"`
|
||||
}
|
||||
|
||||
func (s *StoreOptions) RetentionMaxDaysDuration() time.Duration {
|
||||
return time.Duration(s.RetentionMaxDays) * time.Hour * 24
|
||||
}
|
||||
|
||||
// DNSDiscoveryOptions are settings used for enabling DNS-based discovery
|
||||
// protocol that stores merkle trees in DNS records which contain connection
|
||||
// information for nodes. It's very useful for bootstrapping a p2p network.
|
||||
|
|
Loading…
Reference in New Issue