@@ -86,6 +86,8 @@ private record GetSetMethodFunctions(Function<QuoteCb, BigDecimal> getter, BiCon
8686 private final Scheduler mongoScheduler = Schedulers .newBoundedElastic (6 , 10 , "mongoImport" , 10 );
8787 @ Value ("${single.instance.deployment:false}" )
8888 private boolean singleInstanceDeployment ;
89+ @ Value ("${single.instance.slow-io:false}" )
90+ private boolean slowIo ;
8991
9092 public CoinbaseService (MyMongoRepository myMongoRepository , ServiceUtils serviceUtils ) {
9193 this .myMongoRepository = myMongoRepository ;
@@ -204,13 +206,13 @@ private void processTimeFrame(MyTimeFrame timeFrame1, boolean isDay) {
204206 // Coinbase
205207 final var logFailed = String .format ("Coinbase prepare %s data failed" , isDay ? "day" : "hour" );
206208 Mono <Collection <QuoteCb >> collectCb = this .myMongoRepository .find (query , QuoteCb .class )
207- .timeout (Duration .ofSeconds (30L )).doOnError (ex -> LOG .warn (logFailed , ex ))
209+ .timeout (this . slowIo ? Duration .ofSeconds (30L ) : Duration . ofSeconds ( 10L )).doOnError (ex -> LOG .warn (logFailed , ex ))
208210 .onErrorResume (ex -> Mono .empty ()).subscribeOn (this .mongoScheduler ).collectList ()
209211 .map (quotes -> this .createCbQuoteTimeFrame (timeFrame1 , isDay , quotes ));
210212 collectCb .filter (Predicate .not (Collection ::isEmpty ))
211213 .map (myColl -> this .countRelevantProperties (nonZeroProperties , myColl ))
212214 .flatMap (myColl -> this .myMongoRepository .insertAll (Mono .just (myColl ), isDay ? CB_DAY_COL : CB_HOUR_COL )
213- .timeout (Duration .ofSeconds (30L )).doOnError (ex -> LOG .warn (logFailed , ex ))
215+ .timeout (this . slowIo ? Duration .ofSeconds (30L ) : Duration . ofSeconds ( 10L )).doOnError (ex -> LOG .warn (logFailed , ex ))
214216 .onErrorResume (ex -> Mono .empty ()).subscribeOn (this .mongoScheduler ).collectList ())
215217 .subscribeOn (this .mongoScheduler ).block ();
216218 LOG .info (String .format ("Prepared Coinbase %s Data for: " , isDay ? "Day" : "Hour" )
0 commit comments