mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-21 10:01:55 +00:00
Delta improvements
- Updates resumable-request to 1.0.1 - Updates docker-progress to 2.0.3 - Removes `DEFAULT_DELTA_APPLY_TIMEOUT`; it’s not needed anymore, docker-delta reliably tracks rsync. - Properly end the update when applying the delta results in an error. Change-Type: patch
This commit is contained in:
parent
6ae5303c7d
commit
78f74d757d
@ -29,7 +29,7 @@
|
|||||||
"buffer-equal-constant-time": "^1.0.1",
|
"buffer-equal-constant-time": "^1.0.1",
|
||||||
"coffee-loader": "^0.7.3",
|
"coffee-loader": "^0.7.3",
|
||||||
"coffee-script": "~1.11.0",
|
"coffee-script": "~1.11.0",
|
||||||
"docker-delta": "^2.0.1",
|
"docker-delta": "^2.0.3",
|
||||||
"docker-progress": "^2.7.2",
|
"docker-progress": "^2.7.2",
|
||||||
"docker-toolbelt": "^3.0.1",
|
"docker-toolbelt": "^3.0.1",
|
||||||
"event-stream": "^3.0.20",
|
"event-stream": "^3.0.20",
|
||||||
@ -49,7 +49,7 @@
|
|||||||
"resin-lint": "^1.3.1",
|
"resin-lint": "^1.3.1",
|
||||||
"resin-register-device": "^3.0.0",
|
"resin-register-device": "^3.0.0",
|
||||||
"resin-sync": "^9.1.0",
|
"resin-sync": "^9.1.0",
|
||||||
"resumable-request": "^1.0.0",
|
"resumable-request": "^1.0.1",
|
||||||
"rimraf": "^2.5.4",
|
"rimraf": "^2.5.4",
|
||||||
"rwlock": "^5.0.0",
|
"rwlock": "^5.0.0",
|
||||||
"semver": "^5.3.0",
|
"semver": "^5.3.0",
|
||||||
|
@ -19,8 +19,6 @@ proxyvisor = require './proxyvisor'
|
|||||||
osRelease = require './lib/os-release'
|
osRelease = require './lib/os-release'
|
||||||
deviceConfig = require './device-config'
|
deviceConfig = require './device-config'
|
||||||
|
|
||||||
DEFAULT_DELTA_APPLY_TIMEOUT = 300 * 1000 # 6 minutes
|
|
||||||
|
|
||||||
class UpdatesLockedError extends TypedError
|
class UpdatesLockedError extends TypedError
|
||||||
ImageNotFoundError = (err) ->
|
ImageNotFoundError = (err) ->
|
||||||
return "#{err.statusCode}" is '404'
|
return "#{err.statusCode}" is '404'
|
||||||
@ -220,13 +218,12 @@ fetch = (app, { deltaSource, setDeviceUpdateState = true } = {}) ->
|
|||||||
if conf['RESIN_SUPERVISOR_DELTA'] == '1'
|
if conf['RESIN_SUPERVISOR_DELTA'] == '1'
|
||||||
logSystemEvent(logTypes.downloadAppDelta, app)
|
logSystemEvent(logTypes.downloadAppDelta, app)
|
||||||
deltaOpts = {
|
deltaOpts = {
|
||||||
uuid, apiKey
|
uuid, apiKey, deltaSource
|
||||||
# use user-defined timeouts, but fallback to defaults if none is provided.
|
# use user-defined timeouts, but fallback to defaults if none is provided.
|
||||||
requestTimeout: checkInt(conf['RESIN_SUPERVISOR_DELTA_REQUEST_TIMEOUT'], positive: true)
|
requestTimeout: checkInt(conf['RESIN_SUPERVISOR_DELTA_REQUEST_TIMEOUT'], positive: true)
|
||||||
applyTimeout: checkInt(conf['RESIN_SUPERVISOR_DELTA_APPLY_TIMEOUT'], positive: true) ? DEFAULT_DELTA_APPLY_TIMEOUT
|
applyTimeout: checkInt(conf['RESIN_SUPERVISOR_DELTA_APPLY_TIMEOUT'], positive: true)
|
||||||
retryCount: checkInt(conf['RESIN_SUPERVISOR_DELTA_RETRY_COUNT'], positive: true)
|
retryCount: checkInt(conf['RESIN_SUPERVISOR_DELTA_RETRY_COUNT'], positive: true)
|
||||||
retryInterval: checkInt(conf['RESIN_SUPERVISOR_DELTA_RETRY_INTERVAL'], positive: true)
|
retryInterval: checkInt(conf['RESIN_SUPERVISOR_DELTA_RETRY_INTERVAL'], positive: true)
|
||||||
deltaSource
|
|
||||||
}
|
}
|
||||||
dockerUtils.rsyncImageWithProgress(app.imageId, deltaOpts, onProgress)
|
dockerUtils.rsyncImageWithProgress(app.imageId, deltaOpts, onProgress)
|
||||||
else
|
else
|
||||||
|
@ -25,7 +25,7 @@ getRepoAndTag = (image) ->
|
|||||||
|
|
||||||
applyDelta = (imgSrc, deltaUrl, { requestTimeout, applyTimeout, resumeOpts }, onProgress) ->
|
applyDelta = (imgSrc, deltaUrl, { requestTimeout, applyTimeout, resumeOpts }, onProgress) ->
|
||||||
new Promise (resolve, reject) ->
|
new Promise (resolve, reject) ->
|
||||||
resumable(request, { url: deltaUrl, timeout: requestTimeout }, resumeOpts)
|
req = resumable(request, { url: deltaUrl, timeout: requestTimeout }, resumeOpts)
|
||||||
.on('progress', onProgress)
|
.on('progress', onProgress)
|
||||||
.on('retry', onProgress)
|
.on('retry', onProgress)
|
||||||
.on('error', reject)
|
.on('error', reject)
|
||||||
@ -38,7 +38,7 @@ applyDelta = (imgSrc, deltaUrl, { requestTimeout, applyTimeout, resumeOpts }, on
|
|||||||
deltaStream = dockerDelta.applyDelta(imgSrc, timeout: applyTimeout)
|
deltaStream = dockerDelta.applyDelta(imgSrc, timeout: applyTimeout)
|
||||||
res.pipe(deltaStream)
|
res.pipe(deltaStream)
|
||||||
.on('id', resolve)
|
.on('id', resolve)
|
||||||
.on('error', reject)
|
.on('error', req.destroy.bind(req))
|
||||||
|
|
||||||
do ->
|
do ->
|
||||||
_lock = new Lock()
|
_lock = new Lock()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user