mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-19 15:53:46 +00:00
Show better logs for UpdatesLockedError
Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
@ -132,6 +132,7 @@ module.exports = class DeviceState extends EventEmitter
|
|||||||
@router = createDeviceStateRouter(this)
|
@router = createDeviceStateRouter(this)
|
||||||
@on 'apply-target-state-end', (err) ->
|
@on 'apply-target-state-end', (err) ->
|
||||||
if err?
|
if err?
|
||||||
|
if not (err instanceof UpdatesLockedError)
|
||||||
console.log("Apply error #{err}")
|
console.log("Apply error #{err}")
|
||||||
else
|
else
|
||||||
console.log('Apply success!')
|
console.log('Apply success!')
|
||||||
@ -577,10 +578,14 @@ module.exports = class DeviceState extends EventEmitter
|
|||||||
@failedUpdates += 1
|
@failedUpdates += 1
|
||||||
@reportCurrentState(update_failed: true)
|
@reportCurrentState(update_failed: true)
|
||||||
if @scheduledApply?
|
if @scheduledApply?
|
||||||
|
if not (err instanceof UpdatesLockedError)
|
||||||
console.log("Updating failed, but there's another update scheduled immediately: ", err)
|
console.log("Updating failed, but there's another update scheduled immediately: ", err)
|
||||||
else
|
else
|
||||||
delay = Math.min((2 ** @failedUpdates) * constants.backoffIncrement, @maxPollTime)
|
delay = Math.min((2 ** @failedUpdates) * constants.backoffIncrement, @maxPollTime)
|
||||||
# If there was an error then schedule another attempt briefly in the future.
|
# If there was an error then schedule another attempt briefly in the future.
|
||||||
|
if err instanceof UpdatesLockedError
|
||||||
|
console.log("Updates are locked, retrying in #{delay}ms...")
|
||||||
|
else
|
||||||
console.log('Scheduling another update attempt due to failure: ', delay, err)
|
console.log('Scheduling another update attempt due to failure: ', delay, err)
|
||||||
@triggerApplyTarget({ force, delay, initial })
|
@triggerApplyTarget({ force, delay, initial })
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user