mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-31 16:35:23 +00:00
Issue #420: Avoid supervisor crash without connection by properly memoizing promise-returning functions
device.getID caused a fatal error when connection was down, as the memoization with `promise: true` throws synchronously. Changing memoizee to use `promise: 'then'` makes the memoization work as expected. Change-Type: patch Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
parent
962c5c138b
commit
4d322c72a0
@ -13,7 +13,8 @@ bootstrap = require './bootstrap'
|
|||||||
{ checkTruthy } = require './lib/validation'
|
{ checkTruthy } = require './lib/validation'
|
||||||
osRelease = require './lib/os-release'
|
osRelease = require './lib/os-release'
|
||||||
|
|
||||||
memoizePromise = _.partial(memoizee, _, promise: true)
|
# If we don't use promise: 'then', exceptions will crash the program
|
||||||
|
memoizePromise = _.partial(memoizee, _, promise: 'then')
|
||||||
|
|
||||||
|
|
||||||
exports.getID = memoizePromise ->
|
exports.getID = memoizePromise ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user