@@ -112,8 +112,7 @@ private void insertBsQuote(String currPair) {
112
112
// log.info(res.toString());
113
113
return res ;
114
114
}).timeout (Duration .ofSeconds (5L )).onErrorResume (ex -> {
115
- exceptionLogged .set (true );
116
- LOG .warn (String .format ("Bitstamp data request for %s failed" , currPair ), ex );
115
+ exceptionLogged .set (this .logRequestFailed ("Bitstamp" , currPair , start , ex ));
117
116
return Mono .empty ();
118
117
}).subscribeOn (this .mongoImportScheduler );
119
118
Disposable subscribe = null ;
@@ -135,6 +134,11 @@ private void logDuration(String source, String currPair, LocalTime start) {
135
134
}
136
135
}
137
136
137
+ private boolean logRequestFailed (String source , String currPair , LocalTime start , Throwable ex ) {
138
+ LOG .warn (String .format ("%s data request for %s failed" , source , currPair ), ex );
139
+ return true ;
140
+ }
141
+
138
142
@ Async ("clientTaskExecutor" )
139
143
@ Scheduled (fixedRate = 60000 , initialDelay = 6000 )
140
144
@ SchedulerLock (name = "BitstampQuoteETH_scheduledTask" , lockAtLeastFor = "PT50S" , lockAtMostFor = "PT55S" )
@@ -179,8 +183,7 @@ public void insertCoinbaseQuote() {
179
183
// log.info(resp2.getRates().toString());
180
184
return Mono .just (resp2 .getRates ());
181
185
}).timeout (Duration .ofSeconds (5L )).onErrorResume (ex -> {
182
- exceptionLogged .set (true );
183
- LOG .warn ("Coinbase data request failed" , ex );
186
+ exceptionLogged .set (this .logRequestFailed ("Coinbase" , currPair , start , ex ));
184
187
return Mono .empty ();
185
188
}).subscribeOn (this .mongoImportScheduler );
186
189
Disposable subscribe = request .flatMap (myQuote -> this .coinbaseService .insertQuote (Mono .just (myQuote ))
@@ -210,8 +213,7 @@ public void insertItbitUsdQuote() {
210
213
// log.info(res.toString());
211
214
return res ;
212
215
}).map (paxosQuote -> this .convert (paxosQuote )).timeout (Duration .ofSeconds (5L )).onErrorResume (ex -> {
213
- exceptionLogged .set (true );
214
- LOG .warn (String .format ("Ibit data request for %s failed" , currPair ), ex );
216
+ exceptionLogged .set (this .logRequestFailed ("Ibit" , currPair , start , ex ));
215
217
return Mono .empty ();
216
218
}).subscribeOn (this .mongoImportScheduler );
217
219
Disposable subscribe = request .flatMap (myQuote -> this .itbitService .insertQuote (Mono .just (myQuote ))
@@ -300,8 +302,7 @@ private void insertBfQuote(String currPair) {
300
302
// log.info(res.toString());
301
303
return result ;
302
304
}).timeout (Duration .ofSeconds (5L )).onErrorResume (ex -> {
303
- exceptionLogged .set (true );
304
- LOG .warn (String .format ("Bitfinex data request for %s failed" , currPair ), ex );
305
+ exceptionLogged .set (this .logRequestFailed ("Bitfinex" , currPair , start , ex ));
305
306
return Mono .empty ();
306
307
}).subscribeOn (this .mongoImportScheduler );
307
308
Disposable subscribe = request .flatMap (myQuote -> this .bitfinexService .insertQuote (Mono .just (myQuote ))
0 commit comments