set 10 min quotations timeout
This commit is contained in:
@@ -23,6 +23,7 @@ type config struct {
|
||||
FeeAccounts map[string]string `yaml:"fee_ledger_accounts"`
|
||||
GatewayInstances []gatewayInstanceConfig `yaml:"gateway_instances"`
|
||||
QuoteRetentionHrs int `yaml:"quote_retention_hours"`
|
||||
MaxFXQuoteTTLMs int64 `yaml:"max_fx_quote_ttl_ms"`
|
||||
}
|
||||
|
||||
type clientConfig struct {
|
||||
@@ -78,6 +79,11 @@ type limitsOverrideCfg struct {
|
||||
MaxOps int `yaml:"max_ops"`
|
||||
}
|
||||
|
||||
const (
|
||||
defaultMaxFXQuoteTTL = 10 * time.Minute
|
||||
defaultMaxFXQuoteTTLMillis = int64(defaultMaxFXQuoteTTL / time.Millisecond)
|
||||
)
|
||||
|
||||
func (c clientConfig) callTimeout() time.Duration {
|
||||
if c.CallTimeoutSecs <= 0 {
|
||||
return 3 * time.Second
|
||||
@@ -92,6 +98,13 @@ func (c *config) quoteRetention() time.Duration {
|
||||
return time.Duration(c.QuoteRetentionHrs) * time.Hour
|
||||
}
|
||||
|
||||
func (c *config) maxFXQuoteTTLMillis() int64 {
|
||||
if c == nil || c.MaxFXQuoteTTLMs <= 0 {
|
||||
return defaultMaxFXQuoteTTLMillis
|
||||
}
|
||||
return c.MaxFXQuoteTTLMs
|
||||
}
|
||||
|
||||
func (i *Imp) loadConfig() (*config, error) {
|
||||
data, err := os.ReadFile(i.file)
|
||||
if err != nil {
|
||||
|
||||
@@ -55,6 +55,7 @@ func (i *Imp) buildServiceOptions(cfg *config, deps *orchestratorDeps) []orchest
|
||||
if deps.quotationClient != nil {
|
||||
opts = append(opts, orchestrator.WithQuotationService(deps.quotationClient))
|
||||
}
|
||||
opts = append(opts, orchestrator.WithMaxFXQuoteTTLMillis(cfg.maxFXQuoteTTLMillis()))
|
||||
if deps.gatewayInvokeResolver != nil {
|
||||
opts = append(opts, orchestrator.WithGatewayInvokeResolver(deps.gatewayInvokeResolver))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user