satellite: make order expiration configurable (#2251)

This commit is contained in:
JT Olio 2019-06-21 04:38:40 -06:00 committed by Egon Elbre
parent 76b54458e9
commit 568b000e9b
4 changed files with 16 additions and 6 deletions

View File

@ -49,6 +49,7 @@ import (
"storj.io/storj/satellite/mailservice"
"storj.io/storj/satellite/marketing/marketingweb"
"storj.io/storj/satellite/metainfo"
satorders "storj.io/storj/satellite/orders"
"storj.io/storj/satellite/satellitedb"
"storj.io/storj/satellite/vouchers"
"storj.io/storj/storagenode"
@ -484,6 +485,9 @@ func (planet *Planet) newSatellites(count int) ([]*satellite.Peer, error) {
Overlay: true,
BwExpiration: 45,
},
Orders: satorders.Config{
Expiration: 45 * 24 * time.Hour,
},
Checker: checker.Config{
Interval: 30 * time.Second,
IrreparableInterval: 15 * time.Second,

View File

@ -22,6 +22,11 @@ import (
"storj.io/storj/pkg/storj"
)
// Config is a configuration struct for orders Service.
type Config struct {
Expiration time.Duration `help:"how long until an order expires" default:"1080h"`
}
// Service for creating order limits.
type Service struct {
log *zap.Logger

View File

@ -103,15 +103,14 @@ type DB interface {
// Config is the global config satellite
type Config struct {
Identity identity.Config
// TODO: switch to using server.Config when Identity has been removed from it
Server server.Config
Server server.Config
Kademlia kademlia.Config
Overlay overlay.Config
Discovery discovery.Config
Metainfo metainfo.Config
Orders orders.Config
Checker checker.Config
Repairer repairer.Config
@ -125,8 +124,7 @@ type Config struct {
Console consoleweb.Config
Marketing marketingweb.Config
Vouchers vouchers.Config
Vouchers vouchers.Config
Version version.Config
}
@ -391,7 +389,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, config *Config, ve
peer.Overlay.Service,
peer.DB.CertDB(),
peer.DB.Orders(),
45*24*time.Hour, // TODO: make it configurable?
config.Orders.Expiration,
&pb.NodeAddress{
Transport: pb.NodeTransport_TCP_TLS_GRPC,
Address: config.Kademlia.ExternalAddress,

View File

@ -193,6 +193,9 @@ kademlia.operator.wallet: ""
# path to log for oom notices
# monkit.hw.oomlog: "/var/log/kern.log"
# how long until an order expires
# orders.expiration: 1080h0m0s
# the number of times a node has been audited to not be considered a New Node
# overlay.node.audit-count: 500