Skip to content

Commit 4a083ef

Browse files
committed
fix: improvement
1 parent 3d93ba8 commit 4a083ef

File tree

4 files changed

+30
-16
lines changed

4 files changed

+30
-16
lines changed

backend/src/main/java/ch/xxx/trader/usecase/services/BitfinexService.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class BitfinexService {
6262
private final ReportMapper reportMapper;
6363
private final MyMongoRepository myMongoRepository;
6464
private final ServiceUtils serviceUtils;
65-
private final Scheduler mongoScheduler = Schedulers.newBoundedElastic(10, 10, "mongoImport", 10);
65+
private final Scheduler mongoScheduler = Schedulers.newBoundedElastic(5, 10, "mongoImport", 10);
6666
@Value("${single.instance.deployment:false}")
6767
private boolean singleInstanceDeployment;
6868

@@ -102,12 +102,17 @@ public Mono<String> createBfAvg() {
102102
BitfinexService.singleInstanceLock = true;
103103
result = this.myMongoRepository.ensureIndex(BF_HOUR_COL, DtoUtils.CREATEDAT)
104104
.subscribeOn(this.mongoScheduler).timeout(Duration.ofMinutes(5L))
105-
.doOnError(ex -> LOG.info("ensureIndex(" + BF_HOUR_COL + ") failed.", ex))
105+
.onErrorContinue((ex, val) -> LOG.info("ensureIndex(" + BF_HOUR_COL + ") failed.", ex))
106+
// .doOnError(ex -> LOG.info("ensureIndex(" + BF_HOUR_COL + ") failed.", ex))
106107
.then(this.myMongoRepository.ensureIndex(BF_DAY_COL, DtoUtils.CREATEDAT)
107108
.subscribeOn(this.mongoScheduler).timeout(Duration.ofMinutes(5L))
108-
.doOnError(ex -> LOG.info("ensureIndex(" + BF_DAY_COL + ") failed.", ex)))
109+
.onErrorContinue((ex, val) -> LOG.info("ensureIndex(" + BF_DAY_COL + ") failed.", ex))
110+
// .doOnError(ex -> LOG.info("ensureIndex(" + BF_DAY_COL + ") failed.", ex)))
111+
.onErrorContinue((ex, val) -> LOG.info("ensureIndex(" + BF_DAY_COL + ") failed.", ex)))
109112
.map(value -> this.createHourDayAvg()).timeout(Duration.ofHours(2L))
110-
.doOnError(ex -> LOG.info("createBfAvg() failed.", ex)).subscribeOn(this.mongoScheduler);
113+
// .doOnError(ex -> LOG.info("createBfAvg() failed.", ex))
114+
.onErrorContinue((ex, val) -> LOG.info("createBfAvg() failed.", ex))
115+
.subscribeOn(this.mongoScheduler);
111116
}
112117
return result;
113118
}

backend/src/main/java/ch/xxx/trader/usecase/services/BitstampService.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class BitstampService {
6262
private final ReportMapper reportMapper;
6363
private final MyMongoRepository myMongoRepository;
6464
private final ServiceUtils serviceUtils;
65-
private final Scheduler mongoScheduler = Schedulers.newBoundedElastic(10, 10, "mongoImport", 10);
65+
private final Scheduler mongoScheduler = Schedulers.newBoundedElastic(5, 10, "mongoImport", 10);
6666
@Value("${single.instance.deployment:false}")
6767
private boolean singleInstanceDeployment;
6868

@@ -101,12 +101,15 @@ public Mono<String> createBsAvg() {
101101
BitstampService.singleInstanceLock = true;
102102
result = this.myMongoRepository.ensureIndex(BS_HOUR_COL, DtoUtils.CREATEDAT)
103103
.subscribeOn(this.mongoScheduler).timeout(Duration.ofMinutes(5L))
104-
.doOnError(ex -> LOG.info("ensureIndex(" + BS_HOUR_COL + ") failed.", ex))
104+
// .doOnError(ex -> LOG.info("ensureIndex(" + BS_HOUR_COL + ") failed.", ex))
105+
.onErrorContinue((ex, val) -> LOG.info("ensureIndex(" + BS_HOUR_COL + ") failed.", ex))
105106
.then(this.myMongoRepository.ensureIndex(BS_DAY_COL, DtoUtils.CREATEDAT)
106107
.subscribeOn(this.mongoScheduler).timeout(Duration.ofMinutes(5L))
107-
.doOnError(ex -> LOG.info("ensureIndex(" + BS_DAY_COL + ") failed.", ex)))
108+
// .doOnError(ex -> LOG.info("ensureIndex(" + BS_DAY_COL + ") failed.", ex))
109+
.onErrorContinue((ex, val) -> LOG.info("ensureIndex(" + BS_DAY_COL + ") failed.", ex)))
108110
.map(value -> this.createHourDayAvg()).timeout(Duration.ofHours(3L))
109-
.doOnError(ex -> LOG.info("createBsAvg() failed.", ex))
111+
.onErrorContinue((ex, val) -> LOG.info("createBsAvg() failed.", ex))
112+
// .doOnError(ex -> LOG.info("createBsAvg() failed.", ex))
110113
.subscribeOn(this.mongoScheduler);
111114
}
112115
return result;

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

+7-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private record GetSetMethodFunctions(Function<QuoteCb, BigDecimal> getter, BiCon
7979
private boolean cpuConstraint;
8080
private final List<String> nonValueFieldNames = List.of("_id", "createdAt", "class");
8181
private final List<PropertyDescriptor> propertyDescriptors;
82-
private final Scheduler mongoScheduler = Schedulers.newBoundedElastic(10, 10, "mongoImport", 10);
82+
private final Scheduler mongoScheduler = Schedulers.newBoundedElastic(5, 10, "mongoImport", 10);
8383
@Value("${single.instance.deployment:false}")
8484
private boolean singleInstanceDeployment;
8585

@@ -152,12 +152,15 @@ public Mono<String> createCbAvg() {
152152
CoinbaseService.singleInstanceLock = true;
153153
result = this.myMongoRepository.ensureIndex(CB_HOUR_COL, DtoUtils.CREATEDAT)
154154
.subscribeOn(this.mongoScheduler).timeout(Duration.ofMinutes(5L))
155-
.doOnError(ex -> LOG.info("ensureIndex(" + CB_HOUR_COL + ") failed.", ex))
155+
.onErrorContinue((ex, val) -> LOG.info("ensureIndex(" + CB_HOUR_COL + ") failed.", ex))
156+
// .doOnError(ex -> LOG.info("ensureIndex(" + CB_HOUR_COL + ") failed.", ex))
156157
.then(this.myMongoRepository.ensureIndex(CB_DAY_COL, DtoUtils.CREATEDAT)
157158
.subscribeOn(this.mongoScheduler).timeout(Duration.ofMinutes(5L))
158-
.doOnError(ex -> LOG.info("ensureIndex(" + CB_DAY_COL + ") failed.", ex)))
159+
// .doOnError(ex -> LOG.info("ensureIndex(" + CB_DAY_COL + ") failed.", ex))
160+
.onErrorContinue((ex, val) -> LOG.info("ensureIndex(" + CB_DAY_COL + ") failed.", ex)))
159161
.map(value -> this.createHourDayAvg()).timeout(Duration.ofHours(2L))
160-
.doOnError(ex -> LOG.info("createCbAvg() failed.", ex))
162+
// .doOnError(ex -> LOG.info("createCbAvg() failed.", ex))
163+
.onErrorContinue((ex, val) -> LOG.info("createCbAvg() failed.", ex))
161164
.subscribeOn(this.mongoScheduler);
162165
}
163166
return result;

backend/src/main/java/ch/xxx/trader/usecase/services/ItbitService.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class ItbitService {
6464
private final ReportMapper reportMapper;
6565
private final MyMongoRepository myMongoRepository;
6666
private final ServiceUtils serviceUtils;
67-
private final Scheduler mongoScheduler = Schedulers.newBoundedElastic(10, 10, "mongoImport", 10);
67+
private final Scheduler mongoScheduler = Schedulers.newBoundedElastic(5, 10, "mongoImport", 10);
6868
@Value("${single.instance.deployment:false}")
6969
private boolean singleInstanceDeployment;
7070

@@ -181,12 +181,15 @@ public Mono<String> createIbAvg() {
181181
ItbitService.singleInstanceLock = true;
182182
result = this.myMongoRepository.ensureIndex(IB_HOUR_COL, DtoUtils.CREATEDAT)
183183
.subscribeOn(this.mongoScheduler).timeout(Duration.ofMinutes(5L))
184-
.doOnError(ex -> LOG.info("ensureIndex(" + IB_HOUR_COL + ") failed.", ex))
184+
.onErrorContinue((ex, val) -> LOG.info("ensureIndex(" + IB_HOUR_COL + ") failed.", ex))
185+
// .doOnError(ex -> LOG.info("ensureIndex(" + IB_HOUR_COL + ") failed.", ex))
185186
.then(this.myMongoRepository.ensureIndex(IB_DAY_COL, DtoUtils.CREATEDAT)
186187
.subscribeOn(this.mongoScheduler).timeout(Duration.ofMinutes(5L))
187-
.doOnError(ex -> LOG.info("ensureIndex(" + IB_DAY_COL + ") failed.", ex)))
188+
// .doOnError(ex -> LOG.info("ensureIndex(" + IB_DAY_COL + ") failed.", ex))
189+
.onErrorContinue((ex, val) -> LOG.info("ensureIndex(" + IB_DAY_COL + ") failed.", ex)))
188190
.map(value -> this.createHourDayAvg()).timeout(Duration.ofHours(2L))
189-
.doOnError(ex -> LOG.info("createIbAvg() failed.", ex))
191+
// .doOnError(ex -> LOG.info("createIbAvg() failed.", ex))
192+
.onErrorContinue((ex, val) -> LOG.info("createIbAvg() failed.", ex))
190193
.subscribeOn(this.mongoScheduler);
191194
}
192195
return result;

0 commit comments

Comments
 (0)