Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

Commit

Permalink
fix progress bar, improve database load error
Browse files Browse the repository at this point in the history
  • Loading branch information
xspanger3770 committed Nov 20, 2023
1 parent b538f25 commit c54605b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,20 +166,20 @@ public static void updateProgressBar(String status, int value) {
}

private static void finishInit() {
updateProgressBar("Calibrating...", (int) ((phase++ / (PHASES + 3)) * 100.0));
updateProgressBar("Calibrating...", (int) ((phase++ / (PHASES + 4)) * 100.0));

if(Settings.recalibrateOnLaunch) {
EarthquakeAnalysisTraining.calibrateResolution(MainFrame::updateProgressBar, null);
}

updateProgressBar("Updating Station Sources...", (int) ((phase++ / (PHASES + 3)) * 100.0));
updateProgressBar("Updating Station Sources...", (int) ((phase++ / (PHASES + 4)) * 100.0));
databaseManager.runUpdate(
databaseManager.getStationDatabase().getStationSources().stream()
.filter(StationSource::isOutdated).collect(Collectors.toList()),
() -> {
updateProgressBar("Checking Seedlink Networks...", (int) ((phase++ / (PHASES + 3)) * 100.0));
databaseManager.runAvailabilityCheck(databaseManager.getStationDatabase().getSeedlinkNetworks(), () -> {
updateProgressBar("Saving...", (int) ((phase++ / (PHASES + 3)) * 100.0));
updateProgressBar("Saving...", (int) ((phase++ / (PHASES + 4)) * 100.0));

try {
databaseManager.save();
Expand All @@ -188,7 +188,7 @@ private static void finishInit() {
}
databaseMonitorFrame.initDone();

updateProgressBar("Done", (int) ((phase++ / (PHASES + 3)) * 100.0));
updateProgressBar("Done", (int) ((phase++ / (PHASES + 4)) * 100.0));
});
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public void load() throws FatalIOException {

Logger.info("Database load successfull");
} catch (ClassNotFoundException | IOException e) {
GlobalQuake.getErrorHandler().handleException(new FatalIOException("Unable to read station database!", e));
GlobalQuake.getErrorHandler().handleException(
new FatalIOException("Unable to load station database, it probably got corrupted!", e));
}
}

Expand Down

0 comments on commit c54605b

Please sign in to comment.