rpcsrv: set MaxFindStorageResultItems to default if not specified

Do not use RPC configuration constructor for this, some external services
may skip this part.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
Anna Shaleva 2023-08-29 12:59:41 +03:00
parent dd7c762ff9
commit f5b0489d74
2 changed files with 5 additions and 2 deletions

View file

@ -78,8 +78,7 @@ func LoadFile(configPath string) (Config, error) {
PingTimeout: 90 * time.Second,
},
RPC: RPC{
MaxFindStorageResultItems: DefaultMaxFindStorageResultItems,
MaxNEP11Tokens: 100,
MaxNEP11Tokens: 100,
},
},
}

View file

@ -303,6 +303,10 @@ func New(chain Ledger, conf config.RPC, coreServer *network.Server,
conf.MaxFindResultItems = config.DefaultMaxFindResultItems
log.Info("MaxFindResultItems is not set or wrong, setting default value", zap.Int("MaxFindResultItems", config.DefaultMaxFindResultItems))
}
if conf.MaxFindStorageResultItems <= 0 {
conf.MaxFindStorageResultItems = config.DefaultMaxFindStorageResultItems
log.Info("MaxFindStorageResultItems is not set or wrong, setting default value", zap.Int("MaxFindStorageResultItems", config.DefaultMaxFindStorageResultItems))
}
if conf.MaxWebSocketClients == 0 {
conf.MaxWebSocketClients = defaultMaxWebSocketClients
log.Info("MaxWebSocketClients is not set or wrong, setting default value", zap.Int("MaxWebSocketClients", defaultMaxWebSocketClients))