Skip to content

Commit

Permalink
Server: Add catch block to start-up data fetching
Browse files Browse the repository at this point in the history
This currently fails because the index site does not support IPv6. The
server should tolerate this and continue execution instead of exiting.
  • Loading branch information
StenAL committed Sep 8, 2024
1 parent fc1439f commit 5267e4d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ public void onApplicationEvent(final ApplicationReadyEvent event) {
LocalDateTime lastFetch = batchRepository.findTopByOrderByTimestampDesc().getTimestamp();
if (lastFetch.isBefore(LocalDateTime.now().minusDays(DataImportingJob.FETCH_FREQUENCY_DAYS))) {
log.info("Current stock data is older than {} days. Fetching new data.", DataImportingJob.FETCH_FREQUENCY_DAYS);
updateAllStocks();
try {
updateAllStocks();
} catch (Exception e) {
log.error("Failed to update stocks: {}", e.getMessage(), e);
}
} else {
log.debug("Current stock data is fresh. Not fetching new data");
}
Expand Down

0 comments on commit 5267e4d

Please sign in to comment.