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

Conversation

naman-contentstack
Copy link
Contributor

No description provided.

@naman-contentstack naman-contentstack self-assigned this Jul 17, 2025
@naman-contentstack naman-contentstack requested a review from a team as a code owner July 17, 2025 06:51
@@ -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

@@ -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...');
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

Copy link
Contributor

@netrajpatel netrajpatel left a comment

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

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.

3 participants