Skip to content

Commit dfd5788

Browse files
authored
fix: preparation mode not failing (#1772)
2 parents 14c28f5 + a809518 commit dfd5788

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ RELEASING:
3737
### Added
3838
- documentation for A* config parameters ([#1759](https://github.com/GIScience/openrouteservice/pull/1759))
3939

40+
### Fixed
41+
- preparation mode exiting with code 0 on fail ([#1772](https://github.com/GIScience/openrouteservice/pull/1772))
42+
4043
## [8.0.0] - 2024-03-21
4144
### Added
4245
- snapping service endpoints for returning nearest points on the graph ([#1519](https://github.com/GIScience/openrouteservice/issues/1519))

ors-api/src/main/java/org/heigit/ors/api/servlet/listeners/ORSInitContextListener.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,17 @@ public void contextInitialized(ServletContextEvent contextEvent) {
5555
try {
5656
LOGGER.info("Initializing ORS...");
5757
new RoutingProfileManager(config);
58+
// TODO if feasible, move the preparation mode check to Application.java after the
59+
// RoutingProfileManagerStatus.hasFailed() check.
5860
if (engineProperties.isPreparationMode()) {
61+
if (RoutingProfileManagerStatus.hasFailed()) {
62+
System.exit(1);
63+
}
5964
LOGGER.info("Running in preparation mode, all enabled graphs are built, job is done.");
6065
System.exit(0);
6166
}
6267
} catch (Exception e) {
63-
LOGGER.warn("Unable to initialize ORS due to an unexpected exeception: " + e);
68+
LOGGER.warn("Unable to initialize ORS due to an unexpected exception: " + e);
6469
}
6570
};
6671
Thread thread = new Thread(runnable);
@@ -81,4 +86,4 @@ public void contextDestroyed(ServletContextEvent contextEvent) {
8186
LOGGER.error(e.getMessage());
8287
}
8388
}
84-
}
89+
}

0 commit comments

Comments
 (0)