Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .changeset/seven-rabbits-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
1 change: 1 addition & 0 deletions .github/workflows/health_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ jobs:
check_package_versions:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 10
Copy link
Contributor Author

@sobolk sobolk Sep 23, 2024

Choose a reason for hiding this comment

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

Sometimes this check hangs.
This is to make time to retry faster.

needs:
- install
steps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ import { AsyncLock } from './async_lock.js';
* This class is safe to use in concurrent settings, i.e. tests running in parallel.
*/
export class AmplifyAuthCredentialsFactory {
private readonly userPoolId: string;
private readonly userPoolClientId: string;
private readonly identityPoolId: string;
private readonly allowGuestAccess: boolean | undefined;
/**
* Asynchronous lock is used to assure that all calls to Amplify JS library are
* made in single transaction. This is because that library maintains global state,
* for example auth session.
*/
private readonly lock: AsyncLock = new AsyncLock(60 * 1000);
private static readonly lock: AsyncLock = new AsyncLock(60 * 1000);

private readonly userPoolId: string;
private readonly userPoolClientId: string;
private readonly identityPoolId: string;
private readonly allowGuestAccess: boolean | undefined;

/**
* Creates Amplify Auth credentials factory.
Expand All @@ -47,7 +48,7 @@ export class AmplifyAuthCredentialsFactory {
iamCredentials: IamCredentials;
accessToken: string;
}> => {
await this.lock.acquire();
await AmplifyAuthCredentialsFactory.lock.acquire();
try {
const username = `amplify-backend-${shortUuid()}@amazon.com`;
const temporaryPassword = `Test1@Temp${shortUuid()}`;
Expand Down Expand Up @@ -103,12 +104,12 @@ export class AmplifyAuthCredentialsFactory {
accessToken: authSession.tokens.accessToken.toString(),
};
} finally {
this.lock.release();
AmplifyAuthCredentialsFactory.lock.release();
}
};

getGuestAccessCredentials = async (): Promise<IamCredentials> => {
await this.lock.acquire();
await AmplifyAuthCredentialsFactory.lock.acquire();
try {
Amplify.configure({
Auth: {
Expand All @@ -131,7 +132,7 @@ export class AmplifyAuthCredentialsFactory {

return authSession.credentials;
} finally {
this.lock.release();
AmplifyAuthCredentialsFactory.lock.release();
}
};
}
Loading