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

Use exponential backoff for s3 503 error #46

Merged
merged 6 commits into from
Dec 12, 2022
Merged

Conversation

tuliren
Copy link
Member

@tuliren tuliren commented Dec 11, 2022

Resolve #44.

@stoat-app
Copy link

stoat-app bot commented Dec 11, 2022

Easy and customizable dashboards for your build system. Learn more about Stoat ↗︎

Static Hosting

Name Link Commit Status
Action Test Coverage Visit 94354cf
Action Test Coverage (single file) Visit 94354cf

Job Runtime

debug


describe('when there is no error', function () {
it('uploads the file with one fetch call', async () => {
mockFetch.mockResolvedValue({ ok: true } as Response);
Copy link
Member Author

Choose a reason for hiding this comment

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

Should move this setup to a "beforeEach" block to be consistent across different tests within this file.

Copy link
Contributor

@jrhizor jrhizor left a comment

Choose a reason for hiding this comment

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

Looks good.

Seems likely we'll want to use a library for this at some point like https://www.npmjs.com/package/p-retry as we have more operations that require similar retry logic.

@tuliren
Copy link
Member Author

tuliren commented Dec 12, 2022

Good point. Will switch to use a library.

@tuliren
Copy link
Member Author

tuliren commented Dec 12, 2022

I tried p-retry, but run into some ESM issues, and got this exception:

 FAIL  __tests__/plugins/staticHosting/plugin.test.ts
  ● Test suite failed to run

    Must use import to load ES Module: /Users/lirentu/git/stoat-action/action/node_modules/p-retry/index.js

       6 | // eslint-disable-next-line import/no-unresolved
       7 | import mime from 'mime-types';
    >  8 | import pRetry, { AbortError } from 'p-retry';
         | ^
       9 | import { basename, posix, resolve } from 'path';
      10 |
      11 | import { getApiUrlBase } from '../../stoatApiHelpers';

      at Runtime.requireModule (node_modules/jest-runtime/build/index.js:817:21)
      at Object.<anonymous> (src/plugins/staticHosting/helpers.ts:8:1)
      at Object.<anonymous> (src/plugins/staticHosting/plugin.ts:8:1)
      at Object.<anonymous> (src/plugins/staticHosting/index.ts:1:1)
      at Object.<anonymous> (__tests__/plugins/staticHosting/plugin.test.ts:4:1)

I'd rather not deal with this right now. Created an issue: #47.

@tuliren tuliren merged commit e956178 into main Dec 12, 2022
@tuliren tuliren deleted the liren/prevent-s3-503 branch December 12, 2022 04:43
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.

Handle S3 503 error
2 participants