Skip to content

added a delay to check failing test cases #2002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class AuthenticationHandler {
}

async refreshAccessToken(error: any, maxRetryCount = 1): Promise<void> {
// Add delay to prevent burst requests and help diagnose GoCD pipeline failures
console.log('Adding delay before processing refreshAccessToken...');
Copy link
Contributor

Choose a reason for hiding this comment

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

@naman-contentstack adding log will display in production as well, this wont be a right message to be printed in prod

Copy link
Contributor

Choose a reason for hiding this comment

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

@naman-contentstack, can this be applied for the development environment only, since this will affect production users?

Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid using console logs.
Also, use environment-specific code with a logger or setTimeout

await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 second delay
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest

if(process.env.environment === "development"){
// add code here
}

Copy link
Contributor

Choose a reason for hiding this comment

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

await new Promise((resolve) => setTimeout(resolve, 2000));

can be - await new Promise((resolve) => setTimeout(resolve, process.env.DELAY || 2000));

in any case if we wants to increase or decrease the delay

Copy link
Contributor

Choose a reason for hiding this comment

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

@naman-contentstack, can this be applied for the development environment only, since this will affect production users?

Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid using console logs.
Also, use environment-specific code with a logger or setTimeout

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@netrajpatel The issue was found in the prod e2e, we have discussed an action plan on the basis of env config so that the end user wont be affected

console.log('Delay completed, processing refreshAccessToken');
if (error.response && error.response.status) {
switch (error.response.status) {
case 401:
Expand Down
Loading