Make sure the supervisor version update is also retried until succeeding.

This commit is contained in:
Pagan Gazzard 2015-02-04 13:14:30 +00:00 committed by Pablo Carranza Vélez
parent 1784c75c57
commit 2d5dca2171

View File

@ -36,9 +36,13 @@ knex.init.then ->
console.log('Starting API server..')
secret = randomstring.generate()
api(secret).listen(config.listenPort)
# Let API know what version we are, and our api connection info.
console.log('Updating supervisor version and api info')
application.updateDeviceInfo(
api_port: config.listenPort
api_secret: secret
supervisor_version: utils.supervisorVersion
# Retry the device info update every 5s until it finally succeeds.
5000
)
@ -64,9 +68,3 @@ knex.init.then ->
console.log('Starting periodic check for IP addresses..')
setInterval(updateIpAddr, 30 * 1000) # Every 30s
updateIpAddr()
# Let API know we are running a new version
console.log('Updating supervisor version:', utils.supervisorVersion)
application.updateDeviceInfo(
supervisor_version: utils.supervisorVersion
)