Skip to content

Commit 959ad37

Browse files
committed
add default for supervise interval
1 parent b745452 commit 959ad37

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/attorney.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function getConfig (value) {
130130
config.migrate = ('migrate' in config) ? config.migrate : true
131131

132132
applySchemaConfig(config)
133-
applyMaintenanceConfig(config)
133+
applyOpsConfig(config)
134134
applyScheduleConfig(config)
135135
validateWarningConfig(config)
136136

@@ -201,7 +201,15 @@ function applyPollingInterval (config) {
201201
: 2000
202202
}
203203

204-
function applyMaintenanceConfig (config) {
204+
function applyOpsConfig (config) {
205+
assert(!('superviseIntervalSeconds' in config) || config.superviseIntervalSeconds >= 1,
206+
'configuration assert: superviseIntervalSeconds must be at least every second')
207+
208+
config.superviseIntervalSeconds = config.superviseIntervalSeconds || 60
209+
210+
assert(config.superviseIntervalSeconds / 60 / 60 <= POLICY.MAX_EXPIRATION_HOURS,
211+
`configuration assert: superviseIntervalSeconds cannot exceed ${POLICY.MAX_EXPIRATION_HOURS} hours`)
212+
205213
assert(!('maintenanceIntervalSeconds' in config) || config.maintenanceIntervalSeconds >= 1,
206214
'configuration assert: maintenanceIntervalSeconds must be at least every second')
207215

0 commit comments

Comments
 (0)