Skip to content

logs fallback mode#313

Merged
itai-codefresh merged 4 commits intomasterfrom
saas-2002-logs-fallback
Mar 14, 2019
Merged

logs fallback mode#313
itai-codefresh merged 4 commits intomasterfrom
saas-2002-logs-fallback

Conversation

@yaroslav-codefresh
Copy link
Copy Markdown
Member

No description provided.

const json = await sdk.workflows.get({ id: workflowId });
const workflowInstance = Workflow.fromResponse(json);
switch (workflowInstance.getStatus()) {
case 'success':
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use ENUM values

Comment thread lib/interface/cli/helpers/workflow.js Outdated
const { sdk } = require('../../../logic');
const Workflow = require('../../../logic/entities/Workflow');

const FIFTEEN_MINUTES = 15 * 60 * 1000;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the naming is not good.
lets just use interval and total max retries

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using standard retry npm module
https://github.com/tim-kos/node-retry

Comment thread lib/interface/cli/helpers/workflow.js Outdated
return;
}
console.log(`Current build status is: '${_.upperCase(currentStatus)}'`);
consecutiveErrors = 0; // eslint-disable-line
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are overriding this every time again to 0.

Comment thread lib/interface/cli/helpers/workflow.js Outdated
throw e;
}
consecutiveErrors = (consecutiveErrors || 0) + 1; // eslint-disable-line
if (consecutiveErrors > FIFTEEN_MINUTES / interval) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just use retry npm module. it's super confusing

@itai-codefresh itai-codefresh merged commit e47757c into master Mar 14, 2019
@itai-codefresh itai-codefresh deleted the saas-2002-logs-fallback branch March 14, 2019 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants