Skip to content

Commit

Permalink
limit-friendlier polling on heroku deploy check, error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed May 22, 2019
1 parent 4d2350b commit ea5d3e2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/commands/shane/heroku/repo/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as stripcolor from 'strip-color';
import util = require('util');

const exec = util.promisify(child_process.exec);

const pollingInterval = 2000; // ms polling when checking for app deployment
const herokuAPIendpoint = 'https://api.heroku.com/app-setups';

export default class HerokuRepoDeploy extends SfdxCommand {
Expand Down Expand Up @@ -114,15 +114,14 @@ export default class HerokuRepoDeploy extends SfdxCommand {
json: true,
headers
});
console.log(statusResult);
status = statusResult.status;
sleep(2000);
sleep(pollingInterval);
}

// if error
if (status === 'failed') {
this.ux.log(chalk.red('Error deploying the app'));
if (!this.flags.json){
if (!this.flags.json) {
this.ux.logJson(statusResult);
}
throw new Error(statusResult.failure_message);
Expand Down

0 comments on commit ea5d3e2

Please sign in to comment.