mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-03-25 13:28:34 +00:00
Use the correct interface to compare times using process.hrtime to calculate time since last update cycle
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
parent
8484949a28
commit
9b4f912c7c
@ -30,7 +30,7 @@ updateStatus =
|
||||
failed: 0
|
||||
forceNext: false
|
||||
intervalHandle: null
|
||||
lastFullUpdateCycle: process.hrtime()[0]
|
||||
lastFullUpdateCycle: process.hrtime()
|
||||
currentlyDownloading: false
|
||||
|
||||
class UpdatesLockedError extends TypedError
|
||||
@ -135,7 +135,7 @@ application.UpdatesLockedError = UpdatesLockedError
|
||||
application.localMode = false
|
||||
|
||||
application.healthy = ->
|
||||
timeSinceLastCycle = (process.hrtime()[0] - updateStatus.lastFullUpdateCycle) * 1000
|
||||
timeSinceLastCycle = process.hrtime(updateStatus.lastFullUpdateCycle)[0] * 1000
|
||||
return updateStatus.currentlyDownloading or timeSinceLastCycle <= 2 * config.appUpdatePollInterval
|
||||
|
||||
application.logSystemMessage = logSystemMessage = (message, obj, eventName) ->
|
||||
@ -894,7 +894,7 @@ application.update = update = (force, scheduled = false) ->
|
||||
else
|
||||
updateStatus.state = UPDATE_IDLE
|
||||
device.updateState(status: 'Idle')
|
||||
updateStatus.lastFullUpdateCycle = process.hrtime()[0]
|
||||
updateStatus.lastFullUpdateCycle = process.hrtime()
|
||||
return
|
||||
|
||||
sanitiseContainerName = (name) -> name.replace(/^\//, '')
|
||||
|
Loading…
x
Reference in New Issue
Block a user