Fix callback invokation
This commit is contained in:
@@ -52,9 +52,11 @@ function getCaasCredentials(apiConfig, callback) {
|
||||
assert(apiConfig.token);
|
||||
|
||||
if ((new Date() - gCachedCaasCredentials.issueDate) <= (1.75 * 60 * 60 * 1000)) { // caas gives tokens with 2 hour limit
|
||||
return gCachedCaasCredentials.credentials;
|
||||
return callback(null, gCachedCaasCredentials.credentials);
|
||||
}
|
||||
|
||||
debug('getCaasCredentials: getting new credentials');
|
||||
|
||||
var url = config.apiServerOrigin() + '/api/v1/boxes/' + config.fqdn() + '/awscredentials';
|
||||
superagent.post(url).query({ token: apiConfig.token }).timeout(30 * 1000).end(function (error, result) {
|
||||
if (error && !error.response) return callback(error);
|
||||
|
||||
Reference in New Issue
Block a user