File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -250,11 +250,11 @@ pub struct EnvVars {
250250}
251251
252252impl EnvVars {
253- pub fn from_env ( ) -> Result < Self , envconfig :: Error > {
253+ pub fn from_env ( ) -> Result < Self , anyhow :: Error > {
254254 let inner = Inner :: init_from_env ( ) ?;
255255 let graphql = InnerGraphQl :: init_from_env ( ) ?. into ( ) ;
256256 let mapping_handlers = InnerMappingHandlers :: init_from_env ( ) ?. into ( ) ;
257- let store = InnerStore :: init_from_env ( ) ?. into ( ) ;
257+ let store = InnerStore :: init_from_env ( ) ?. try_into ( ) ? ;
258258
259259 // The default reorganization (reorg) threshold is set to 250.
260260 // For testing purposes, we need to set this threshold to 0 because:
Original file line number Diff line number Diff line change @@ -142,9 +142,11 @@ impl fmt::Debug for EnvVarsStore {
142142 }
143143}
144144
145- impl From < InnerStore > for EnvVarsStore {
146- fn from ( x : InnerStore ) -> Self {
147- Self {
145+ impl TryFrom < InnerStore > for EnvVarsStore {
146+ type Error = anyhow:: Error ;
147+
148+ fn try_from ( x : InnerStore ) -> Result < Self , Self :: Error > {
149+ let vars = Self {
148150 chain_head_watcher_timeout : Duration :: from_secs ( x. chain_head_watcher_timeout_in_secs ) ,
149151 query_stats_refresh_interval : Duration :: from_secs (
150152 x. query_stats_refresh_interval_in_secs ,
@@ -184,7 +186,15 @@ impl From<InnerStore> for EnvVarsStore {
184186 last_rollup_from_poi : x. last_rollup_from_poi ,
185187 insert_extra_cols : x. insert_extra_cols ,
186188 fdw_fetch_size : x. fdw_fetch_size ,
189+ } ;
190+ if let Some ( timeout) = vars. batch_timeout {
191+ if timeout < 2 * vars. batch_target_duration {
192+ bail ! (
193+ "GRAPH_STORE_BATCH_TIMEOUT must be greater than 2*GRAPH_STORE_BATCH_TARGET_DURATION"
194+ ) ;
195+ }
187196 }
197+ Ok ( vars)
188198 }
189199}
190200
You can’t perform that action at this time.
0 commit comments