Auto-merge for PR #715 via VersionBot

Add a backoff mechanism for state reporting errors.
This commit is contained in:
resin-io-versionbot[bot] 2018-08-01 19:58:34 +00:00 committed by GitHub
commit 50e9df08fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View File

@ -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/).
## v7.16.3 - 2018-08-01
* Add a backoff mechanism for state reporting errors #715 [Pagan Gazzard]
## v7.16.2 - 2018-07-25
* Fix: Fix scoping issue with variables in service-manager #711 [Cameron Diver]

View File

@ -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": "7.16.2",
"version": "7.16.3",
"license": "Apache-2.0",
"repository": {
"type": "git",

View File

@ -16,7 +16,7 @@ DuplicateUuidError = (err) ->
ExchangeKeyError = class ExchangeKeyError extends TypedError
REPORT_SUCCESS_DELAY = 1000
REPORT_RETRY_DELAY = 5000
MAX_REPORT_RETRY_DELAY = 60000
createAPIBinderRouter = (apiBinder) ->
router = express.Router()
@ -439,7 +439,8 @@ module.exports = class APIBinder
.catch (err) =>
@stateReportErrors += 1
@eventTracker.track('Device state report failure', { error: err })
Promise.delay(REPORT_RETRY_DELAY)
delay = Math.min((2 ** @stateReportErrors) * 500, MAX_REPORT_RETRY_DELAY)
Promise.delay(delay)
.then =>
@_reportCurrentState()
return null