@@ -86,6 +86,8 @@ private record GetSetMethodFunctions(Function<QuoteCb, BigDecimal> getter, BiCon
86
86
private final Scheduler mongoScheduler = Schedulers .newBoundedElastic (6 , 10 , "mongoImport" , 10 );
87
87
@ Value ("${single.instance.deployment:false}" )
88
88
private boolean singleInstanceDeployment ;
89
+ @ Value ("${single.instance.slow-io:false}" )
90
+ private boolean slowIo ;
89
91
90
92
public CoinbaseService (MyMongoRepository myMongoRepository , ServiceUtils serviceUtils ) {
91
93
this .myMongoRepository = myMongoRepository ;
@@ -204,13 +206,13 @@ private void processTimeFrame(MyTimeFrame timeFrame1, boolean isDay) {
204
206
// Coinbase
205
207
final var logFailed = String .format ("Coinbase prepare %s data failed" , isDay ? "day" : "hour" );
206
208
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 ))
208
210
.onErrorResume (ex -> Mono .empty ()).subscribeOn (this .mongoScheduler ).collectList ()
209
211
.map (quotes -> this .createCbQuoteTimeFrame (timeFrame1 , isDay , quotes ));
210
212
collectCb .filter (Predicate .not (Collection ::isEmpty ))
211
213
.map (myColl -> this .countRelevantProperties (nonZeroProperties , myColl ))
212
214
.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 ))
214
216
.onErrorResume (ex -> Mono .empty ()).subscribeOn (this .mongoScheduler ).collectList ())
215
217
.subscribeOn (this .mongoScheduler ).block ();
216
218
LOG .info (String .format ("Prepared Coinbase %s Data for: " , isDay ? "Day" : "Hour" )
0 commit comments