 		return
 	updateStatus.state = UPDATE_UPDATING
 	bootstrap.done.then ->
-		Promise.all([
-			knex('config').select('value').where(key: 'apiKey')
-			knex('config').select('value').where(key: 'uuid')
-			knex('app').select()
-		])
-		.then ([ [ apiKey ], [ uuid ], apps ]) ->
-			apiKey = apiKey.value
-			uuid = uuid.value
-
+		Promise.join getConfig('apiKey'), getConfig('uuid'), knex('app').select(), (apiKey, uuid, apps) ->
 			deviceId = device.getID()
 			remoteApps = getRemoteApps(uuid, apiKey)
 

				.catch ENOENT, _.noop
				.catch (err) ->
					release()
					err = new Error("Updates are locked: #{err.message}")
					err.isLocked = true
					throw err
		.disposer (release) ->
			Promise.try ->
				lockFile.unlockAsync(lockName) if force != true

	allAppIds = _.union(localAppIds, remoteAppIds)
	return { toBeRemoved, toBeDownloaded, toBeInstalled, toBeUpdated, appsWithChangedEnvs, allAppIds }

getConfig = (key) ->
	knex('config').select('value').where({ key }).get(0).get('value')

application.update = update = (force) ->
	if updateStatus.state isnt UPDATE_IDLE
		# Mark an update required after the current.
