fix(config): fail fast on invalid operation-day zone
运营日时区只认 PARAM:msgx.operation-day.zone:JobRunner、HistorySweepJob、JdbcSnapshotLogRepository.purgeBefore 改走注入的 OperationDayProps;ScheduleProcessor/AdftProcessor 删除「非法值回退字面量」;新增 @Context 启动自检 OperationDayZoneCheck,配置错位在启动时暴露。 验证:./gradlew test 126 tests / 0 fail(新增 OperationDayPropsTest 覆盖合法解析与非法即失败)。
This commit is contained in:
+3
-1
@@ -1,5 +1,6 @@
|
||||
package com.gzzn.omms.msgexchange.infra.persistence.jdbc
|
||||
|
||||
import com.gzzn.omms.msgexchange.config.OperationDayProps
|
||||
import com.gzzn.omms.msgexchange.domain.ErrorClass
|
||||
import com.gzzn.omms.msgexchange.domain.EventStatus
|
||||
import com.gzzn.omms.msgexchange.domain.EventType
|
||||
@@ -818,6 +819,7 @@ class JdbcFlightStateRepository(
|
||||
class JdbcSnapshotLogRepository(
|
||||
private val ds: DataSource,
|
||||
private val clock: Clock,
|
||||
private val operationDayProps: OperationDayProps,
|
||||
) : SnapshotLogRepository, SnapshotLogPurge {
|
||||
/** 只追加写;这里不抛异常,写失败由调用方捕获并记为指标。 */
|
||||
override fun append(entry: SnapshotLogEntry) {
|
||||
@@ -847,7 +849,7 @@ class JdbcSnapshotLogRepository(
|
||||
ds.update(
|
||||
"DELETE FROM schd_snap_log WHERE scope_end < ? AND recv_at < ?",
|
||||
{ ps ->
|
||||
val cutoffDay = java.time.LocalDate.ofInstant(instant, java.time.ZoneId.of("Asia/Shanghai"))
|
||||
val cutoffDay = java.time.LocalDate.ofInstant(instant, operationDayProps.zoneId())
|
||||
ps.setDate(1, java.sql.Date.valueOf(cutoffDay))
|
||||
ps.setTimestamp(2, instant.toSqlTimestamp())
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user