Skip to content

Add retries to all API calls - #306

Merged
dhadka merged 2 commits into
masterfrom
with-retries
May 11, 2020
Merged

dhadka merged 2 commits into
masterfrom
with-retries

Conversation

@dhadka

@dhadka dhadka commented May 11, 2020 •

Copy link
Copy Markdown
Contributor

Adds one retry to every API call if a retryable http response code is returned (e.g., 503) or an Error is thrown (e.g., socket-level timeout).

Helps with #267

@joshmgross joshmgross left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me. This feels like something that should be done at the http-client level (actions/http-client#4), but I understand why retrying write operations depends on the specific use-cases.

Comment thread src/cacheHttpClient.ts
const response = await httpClient.getJson<ArtifactCacheEntry>(
getCacheApiUrl(resource)
const response = await retryTypedResponse("getCacheEntry", () =>
httpClient.getJson<ArtifactCacheEntry>(getCacheApiUrl(resource))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The http-client has built-in retries for read operations that we could use for this call and downloadCache. It's on the IRequestOptions and is ignored for write operations.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'd have to check again, but I think one issue with http-client is that it only retries on certain http status codes. If there's a socket-level error, it wouldn't retry. But as you say, this is certainly something that could be put into http-client.

@dhadka
dhadka merged commit bac1a40 into master May 11, 2020
@dhadka
dhadka deleted the with-retries branch May 11, 2020 21:57
richardxia added a commit to chipsalliance/rocket-chip that referenced this pull request May 16, 2020
richardxia added a commit to chipsalliance/rocket-chip that referenced this pull request May 21, 2020
richardxia added a commit to chipsalliance/rocket-chip that referenced this pull request May 21, 2020
* Use newer actions/cache for improved reliability.

Per actions/cache#141 (comment), several
of the recent commits have improved reliability:

- actions/cache#306
- actions/cache#300
- actions/cache#305

* Use version of actions/cache with fixed arguments for zstd on Ubuntu 16.04.
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.

2 participants