mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-24 15:56:40 +00:00
Auto-merge for PR #480 via VersionBot
Avoid an indefinite recursion that grows the call stack when reporting the current state fails
This commit is contained in:
commit
bb350eca92
@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
|
||||
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## v6.4.2 - 2017-11-03
|
||||
|
||||
* Avoid an indefinite recursion that grows the call stack when reporting the current state fails #480 [Pablo Carranza Velez]
|
||||
|
||||
## v6.4.1 - 2017-11-02
|
||||
|
||||
* Improve caching when building gosuper #520 [Pablo Carranza Velez]
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "resin-supervisor",
|
||||
"description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.",
|
||||
"version": "6.4.1",
|
||||
"version": "6.4.2",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -181,7 +181,7 @@ exports.getDeviceType = memoizePromise ->
|
||||
do ->
|
||||
APPLY_STATE_SUCCESS_DELAY = 1000
|
||||
APPLY_STATE_RETRY_DELAY = 5000
|
||||
applyPromise = Promise.resolve()
|
||||
applyPending = false
|
||||
targetState = {}
|
||||
actualState = {}
|
||||
updateState = { update_pending: false, update_failed: false, update_downloaded: false }
|
||||
@ -193,8 +193,10 @@ do ->
|
||||
applyState = ->
|
||||
stateDiff = getStateDiff()
|
||||
if _.size(stateDiff) is 0
|
||||
applyPending = false
|
||||
return
|
||||
applyPromise = Promise.join(
|
||||
applyPending = true
|
||||
Promise.join(
|
||||
utils.getConfig('apiKey')
|
||||
device.getID()
|
||||
(apiKey, deviceID) ->
|
||||
@ -219,7 +221,7 @@ do ->
|
||||
Promise.delay(APPLY_STATE_RETRY_DELAY)
|
||||
.finally ->
|
||||
# Check if any more state diffs have appeared whilst we've been processing this update.
|
||||
applyState()
|
||||
setImmediate(applyState)
|
||||
|
||||
exports.setUpdateState = (value) ->
|
||||
_.merge(updateState, value)
|
||||
@ -238,7 +240,7 @@ do ->
|
||||
_.merge(targetState, updatedState)
|
||||
|
||||
# Only trigger applying state if an apply isn't already in progress.
|
||||
if !applyPromise.isPending()
|
||||
if !applyPending
|
||||
applyState()
|
||||
return
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user