Move the starting timeout to a config var.

This commit is contained in:
Pagan Gazzard 2014-10-03 18:42:32 +01:00 committed by Pablo Carranza Vélez
parent 2210b1be29
commit 2d8df956a6
2 changed files with 3 additions and 2 deletions

View File

@ -10,6 +10,7 @@ module.exports = config =
configMountPoint: process.env.CONFIG_MOUNT_POINT ? '/mnt/mmcblk0p1/config.json' configMountPoint: process.env.CONFIG_MOUNT_POINT ? '/mnt/mmcblk0p1/config.json'
ledFile: process.env.LED_FILE ? '/sys/class/leds/led0/brightness' ledFile: process.env.LED_FILE ? '/sys/class/leds/led0/brightness'
bootstrapRetryDelay: process.env.BOOTSTRAP_RETRY_DELAY_MS ? 30000 bootstrapRetryDelay: process.env.BOOTSTRAP_RETRY_DELAY_MS ? 30000
restartSuccessTimeout: process.env.RESTART_SUCCESS_TIMEOUT ? 60000
successMessage: 'SUPERVISOR OK' successMessage: 'SUPERVISOR OK'
config.heartbeatEndpoint = config.apiEndpoint + '/ping' config.heartbeatEndpoint = config.apiEndpoint + '/ping'

View File

@ -57,10 +57,10 @@ startNewSupervisor = (currentSupervisor, waitForSuccess = true) ->
) )
stream.on 'end', -> stream.on 'end', ->
reject(new Error('New supervisor stopped before success message')) reject(new Error('New supervisor stopped before success message'))
.timeout(60000) # wait up to 1 minute .timeout(config.restartSuccessTimeout) # wait up to 1 minute
.catch (e) -> .catch (e) ->
container.stopAsync() container.stopAsync()
console.log('Container failed to start successfully. Error: ', e) console.error('Container failed to start successfully. Error: ', e)
throw e throw e
.then -> .then ->
# We've started the new container, so we're done here! #pray # We've started the new container, so we're done here! #pray