Don't start connectivity check when in offlineMode

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2018-11-27 14:29:55 +00:00
parent ce543d820f
commit 2e80b49da1
No known key found for this signature in database
GPG Key ID: 49690ED87032539F

View File

@ -168,7 +168,7 @@ module.exports = class DeviceState extends EventEmitter
@config.getMany([
'initialConfigSaved', 'listenPort', 'apiSecret', 'osVersion', 'osVariant',
'version', 'provisioned', 'apiEndpoint', 'connectivityCheckEnabled', 'legacyAppsPresent',
'targetStateSet'
'targetStateSet', 'offlineMode'
])
.then (conf) =>
Promise.try =>
@ -214,7 +214,8 @@ module.exports = class DeviceState extends EventEmitter
.then =>
@triggerApplyTarget({ initial: true })
initNetworkChecks: ({ apiEndpoint, connectivityCheckEnabled }) =>
initNetworkChecks: ({ apiEndpoint, connectivityCheckEnabled, offlineMode }) =>
return if validation.checkTruthy(offlineMode)
network.startConnectivityCheck apiEndpoint, connectivityCheckEnabled, (connected) =>
@connected = connected
@config.on 'change', (changedConfig) ->