Skip to content

Commit c1df4e3

Browse files
committed
fix: timeouts
1 parent 7c3c2f9 commit c1df4e3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: backend/src/main/java/ch/xxx/trader/usecase/services/CoinbaseService.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ private String createHourDayAvg() {
183183
CompletableFuture<String> future7 = CompletableFuture.supplyAsync(() -> {
184184
this.createCbIntervalAvg(false);
185185
return "createCbHourlyAvg() Done.";
186-
}, CompletableFuture.delayedExecutor(10, TimeUnit.SECONDS));
186+
}, CompletableFuture.delayedExecutor(1, TimeUnit.SECONDS));
187187
CompletableFuture<String> future8 = CompletableFuture.supplyAsync(() -> {
188188
this.createCbIntervalAvg(true);
189189
return "createCbDailyAvg() Done.";
190-
}, CompletableFuture.delayedExecutor(10, TimeUnit.SECONDS));
190+
}, CompletableFuture.delayedExecutor(1, TimeUnit.SECONDS));
191191
String combined = Stream.of(future7, future8).map(CompletableFuture::join).collect(Collectors.joining(" "));
192192
LOG.info(combined);
193193
}
@@ -204,13 +204,13 @@ private void processTimeFrame(MyTimeFrame timeFrame1, boolean isDay) {
204204
// Coinbase
205205
final var logFailed = String.format("Coinbase prepare %s data failed", isDay ? "day" : "hour");
206206
Mono<Collection<QuoteCb>> collectCb = this.myMongoRepository.find(query, QuoteCb.class)
207-
.timeout(Duration.ofSeconds(10L)).doOnError(ex -> LOG.warn(logFailed, ex))
207+
.timeout(Duration.ofSeconds(30L)).doOnError(ex -> LOG.warn(logFailed, ex))
208208
.onErrorResume(ex -> Mono.empty()).subscribeOn(this.mongoScheduler).collectList()
209209
.map(quotes -> this.createCbQuoteTimeFrame(timeFrame1, isDay, quotes));
210210
collectCb.filter(Predicate.not(Collection::isEmpty))
211211
.map(myColl -> this.countRelevantProperties(nonZeroProperties, myColl))
212212
.flatMap(myColl -> this.myMongoRepository.insertAll(Mono.just(myColl), isDay ? CB_DAY_COL : CB_HOUR_COL)
213-
.timeout(Duration.ofSeconds(10L)).doOnError(ex -> LOG.warn(logFailed, ex))
213+
.timeout(Duration.ofSeconds(30L)).doOnError(ex -> LOG.warn(logFailed, ex))
214214
.onErrorResume(ex -> Mono.empty()).subscribeOn(this.mongoScheduler).collectList())
215215
.subscribeOn(this.mongoScheduler).block();
216216
LOG.info(String.format("Prepared Coinbase %s Data for: ", isDay ? "Day" : "Hour")

0 commit comments

Comments
 (0)