mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-05 01:00:48 +00:00
fix: Don't send internal state tracking information to the API
Change-type: patch Signed-off-by: Cameron Diver <cameron@resin.io>
This commit is contained in:
parent
45dd8c6d69
commit
8abbfe36e0
@ -18,6 +18,12 @@ ExchangeKeyError = class ExchangeKeyError extends TypedError
|
|||||||
REPORT_SUCCESS_DELAY = 1000
|
REPORT_SUCCESS_DELAY = 1000
|
||||||
MAX_REPORT_RETRY_DELAY = 60000
|
MAX_REPORT_RETRY_DELAY = 60000
|
||||||
|
|
||||||
|
INTERNAL_STATE_KEYS = [
|
||||||
|
'update_pending',
|
||||||
|
'update_downloaded',
|
||||||
|
'update_failed',
|
||||||
|
]
|
||||||
|
|
||||||
createAPIBinderRouter = (apiBinder) ->
|
createAPIBinderRouter = (apiBinder) ->
|
||||||
router = express.Router()
|
router = express.Router()
|
||||||
router.use(bodyParser.urlencoded(extended: true))
|
router.use(bodyParser.urlencoded(extended: true))
|
||||||
@ -392,10 +398,14 @@ module.exports = class APIBinder
|
|||||||
|
|
||||||
_getStateDiff: =>
|
_getStateDiff: =>
|
||||||
diff = {
|
diff = {
|
||||||
local: _.omitBy @stateForReport.local, (val, key) =>
|
local: _(@stateForReport.local)
|
||||||
_.isEqual(@lastReportedState.local[key], val)
|
.omitBy((val, key) => _.isEqual(@lastReportedState.local[key], val))
|
||||||
dependent: _.omitBy @stateForReport.dependent, (val, key) =>
|
.omit(INTERNAL_STATE_KEYS)
|
||||||
_.isEqual(@lastReportedState.dependent[key], val)
|
.value()
|
||||||
|
dependent: _(@stateForReport.dependent)
|
||||||
|
.omitBy((val, key) => _.isEqual(@lastReportedState.dependent[key], val))
|
||||||
|
.omit(INTERNAL_STATE_KEYS)
|
||||||
|
.value()
|
||||||
}
|
}
|
||||||
return _.pickBy(diff, _.negate(_.isEmpty))
|
return _.pickBy(diff, _.negate(_.isEmpty))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user