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

DR-3297: Restore API request timeout #259

Closed
wants to merge 2 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
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed

- removed unneccessary variables post reverse proxy launch
- Removed unnecessary variables post reverse proxy launch
- Removed new relic files from frontend (DR-3311)

### Added
Expand All @@ -18,9 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Updated

- refactored implementation of default featured item & updated default number of digitized items (DR-3305)
- Refactored implementation of default featured item & updated default number of digitized items (DR-3305)
- Update thumbnail logic so thumbnails are never restricted (DR-3293)
- Update feedback form credentials to use official DR service account (DR-2794)
- Update timeout on API request to 10 seconds (DR-3304)

## [0.2.4] 2024-11-26

Expand Down
4 changes: 2 additions & 2 deletions app/src/utils/fetchApi.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ describe("fetchApi", () => {

const apiCall = fetchApi(mockApiUrl);

jest.advanceTimersByTime(14000);
jest.advanceTimersByTime(10000);

await expect(apiCall).rejects.toEqual(
new Error("fetchApi: Request timed out")
);

jest.useRealTimers();
}, 20000);
}, 15000);
});
4 changes: 2 additions & 2 deletions app/src/utils/fetchApi.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Makes a GET or POST request to the Repo API and returns the response.
* Times out at 14 seconds to prevent 504 crash.
* Times out at 10 seconds to prevent 504 crash.
* @param {string} apiUrl - The URL for the API request.
* @param {object} options - Options for the request:
* - method: "GET" or "POST" (default is "GET").
Expand Down Expand Up @@ -28,7 +28,7 @@ export const fetchApi = async (
apiUrl += queryString;
}

const timeout = 14000;
const timeout = 10000;

const fetchWithTimeout = (url: string, opts: RequestInit) => {
return Promise.race([
Expand Down
Loading