storagenode: Increase order sending request timeout (#2930)

This commit is contained in:
Michal Niewrzal 2019-09-02 13:24:02 +02:00 committed by GitHub
parent 10a896bf73
commit 3fbe31aada
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 5 deletions

View File

@ -82,6 +82,7 @@ type DB interface {
type Config struct {
SenderInterval time.Duration `help:"duration between sending" default:"1h0m0s"`
SenderTimeout time.Duration `help:"timeout for sending" default:"1h0m0s"`
SenderRequestTimeout time.Duration `help:"timeout for read/write operations during sending" default:"1h0m0s"`
CleanupInterval time.Duration `help:"duration between archive cleanups" default:"24h0m0s"`
ArchiveTTL time.Duration `help:"length of time to archive orders before deletion" default:"168h0m0s"` // 7 days
}

View File

@ -290,9 +290,20 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten
}
pb.RegisterPiecestoreServer(peer.Server.GRPC(), peer.Storage2.Endpoint)
sc := config.Server
options, err := tlsopts.NewOptions(peer.Identity, sc.Config, revocationDB)
if err != nil {
return nil, errs.Combine(err, peer.Close())
}
// TODO workaround for custom timeout for order sending request (read/write)
ordersTransport := transport.NewClientWithTimeouts(options, transport.Timeouts{
Request: config.Storage2.Orders.SenderRequestTimeout,
})
peer.Storage2.Orders = orders.NewService(
log.Named("orders"),
peer.Transport,
ordersTransport,
peer.DB.Orders(),
peer.Storage2.Trust,
config.Storage2.Orders,