mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-20 06:07:57 +00:00
Retry the bootstrap process if it fails - this means that we remove a point of failure (the previous connectivity check barrier merely reduced the chance of hitting that failure point)
This commit is contained in:
parent
7866d7a9f7
commit
f43afd4a95
@ -37,9 +37,13 @@ ensureConnected = (continuous = false) ->
|
||||
knex('config').select('value').where(key: 'uuid').then ([ uuid ]) ->
|
||||
if not uuid?.value
|
||||
console.log('New device detected. Bootstrapping..')
|
||||
ensureConnected().then ->
|
||||
retryingBootstrap = ->
|
||||
utils.mixpanelTrack('Device bootstrap')
|
||||
bootstrap()
|
||||
bootstrap().catch (err) ->
|
||||
utils.mixpanelTrack("Device bootstrap failed due to #{err?.message}, retrying in #{config.bootstrapRetryDelay}ms")
|
||||
Promise.delay(config.bootstrapRetryDelay)
|
||||
.then(retryingBootstrap)
|
||||
retryingBootstrap()
|
||||
else
|
||||
uuid.value
|
||||
.then (uuid) ->
|
||||
|
@ -9,6 +9,7 @@ module.exports = config =
|
||||
localImage: process.env.SUPERVISOR_IMAGE ? 'resin/rpi-supervisor'
|
||||
configMountPoint: process.env.CONFIG_MOUNT_POINT ? '/mnt/mmcblk0p1/config.json'
|
||||
ledFile: process.env.LED_FILE ? '/sys/class/leds/led0/brightness'
|
||||
bootstrapRetryDelay: process.env.BOOTSTRAP_RETRY_DELAY_MS ? 30000
|
||||
successMessage: 'SUPERVISOR OK'
|
||||
|
||||
config.heartbeatEndpoint = config.apiEndpoint + '/ping'
|
||||
|
Loading…
Reference in New Issue
Block a user