Skip to content
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

fix(github): Increase artifact polling interval and max retries #484

Closed
wants to merge 3 commits into from
Closed
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
12 changes: 6 additions & 6 deletions src/artifact_providers/__tests__/github.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ describe('GitHub Artifact Provider', () => {
`);
});

test('it should throw when no artifacts are found after 3 retries', async () => {
test('it should throw when no artifacts are found after 10 retries', async () => {
mockClient.actions.listArtifactsForRepo.mockResolvedValue({
status: 200,
data: {
Expand All @@ -253,11 +253,11 @@ describe('GitHub Artifact Provider', () => {
'1b843f2cbb20fdda99ef749e29e75e43e6e43b38'
)
).rejects.toThrowErrorMatchingInlineSnapshot(
`"Can't find any artifacts for revision "1b843f2cbb20fdda99ef749e29e75e43e6e43b38" (tries: 3)"`
`"Can't find any artifacts for revision "1b843f2cbb20fdda99ef749e29e75e43e6e43b38" (tries: 10)"`
);

expect(mockClient.actions.listArtifactsForRepo).toBeCalledTimes(3);
expect(sleep).toBeCalledTimes(2);
expect(mockClient.actions.listArtifactsForRepo).toBeCalledTimes(10);
expect(sleep).toBeCalledTimes(9);
});

test('it should throw when no artifacts with the name can be found', async () => {
Expand Down Expand Up @@ -302,9 +302,9 @@ describe('GitHub Artifact Provider', () => {
'3c2e87573d3bd16f61cf08fece0638cc47a4fc22'
)
).rejects.toThrowErrorMatchingInlineSnapshot(
`"Can't find any artifacts for revision "3c2e87573d3bd16f61cf08fece0638cc47a4fc22" (tries: 3)"`
`"Can't find any artifacts for revision "3c2e87573d3bd16f61cf08fece0638cc47a4fc22" (tries: 10)"`
);
expect(sleep).toBeCalledTimes(2);
expect(sleep).toBeCalledTimes(9);
});
});

Expand Down
4 changes: 2 additions & 2 deletions src/artifact_providers/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import {
import { extractZipArchive } from '../utils/system';
import { sleep } from '../utils/async';

const MAX_TRIES = 3;
const MAX_TRIES = 10;
const MILLISECONDS = 1000;
const ARTIFACTS_POLLING_INTERVAL = 10 * MILLISECONDS;
const ARTIFACTS_POLLING_INTERVAL = 30 * MILLISECONDS;

export type ArtifactItem = RestEndpointMethodTypes['actions']['listArtifactsForRepo']['response']['data']['artifacts'][0];

Expand Down
Loading