10.6. 设置解决者终止时间
如果您的计划应用程序没有终止设置或终止事件,它理论上会永久运行,并最终会导致 HTTP 超时错误。要防止这种情况发生,请使用 optaplanner.solver.termination.spent-limit
参数指定应用程序终止的时间长度。在大多数应用程序中,将时间至少设置为五分钟(5m
)。但是,在 Timetable 示例中,将过期时间限制为 5 秒,这足够短,以避免 HTTP 超时。
流程
使用以下内容创建 src/main/resources/application.properties
文件:
quarkus.optaplanner.solver.termination.spent-limit=5s