Fix: persist catalog classification to DB after GPN failure. Previously, reclassifyDeviceFromCatalog was called but the result was not saved (first persist happened before catalog call). Now: setUnsupported → recordFailure → reclassify via catalog → persist (single createOrUpdate with full snapshot including classified params). All 811 tests pass. Build status: Success
This commit is contained in:
1 parent
f522e184b1
commit
a9c7bcf643
1 file changed
+5
-5
@@ -135,7 +135,10 @@ class DiscoveringParametersState extends DeviceState {
|
||||
context.device.setGpnStatus('unsupported')
|
||||
context.device.recordGpnFailure()
|
||||
|
||||
// Persist circuit breaker state immediately so it survives session drops
|
||||
// GPN failed → classify params via catalog instead
|
||||
reclassifyDeviceFromCatalog(context.device)
|
||||
|
||||
// Persist device with classification + circuit breaker state
|
||||
try {
|
||||
const hashId = getDeviceHashIdentifier({
|
||||
manufacturer: context.device.deviceId.manufacturer,
|
||||
@@ -157,15 +160,12 @@ class DiscoveringParametersState extends DeviceState {
|
||||
})
|
||||
logger.info(
|
||||
{ hashId, gpnStatus: context.device.gpnStatus, circuitBreaker: context.device.gpnCircuitBreaker },
|
||||
'[DiscoveringParameters] Persisted GPN failure state to DB'
|
||||
'[DiscoveringParameters] Persisted GPN failure + catalog classification to DB'
|
||||
)
|
||||
} catch (e) {
|
||||
logger.error(`Failed to persist GPN circuit breaker state: ${e}`)
|
||||
}
|
||||
|
||||
// GPN failed → classify params via catalog instead
|
||||
reclassifyDeviceFromCatalog(context.device)
|
||||
|
||||
return { nextState: new CriticalReadsState(), response: '' }
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user