Skip to content

Commit

Permalink
UIIN-2006 avoid timeouts when retrieving item-counts (#1653)
Browse files Browse the repository at this point in the history
Instance records with N holdings-records will have to issue N queries to
count their items and this can take a looooong time, longer than the
default timeout as configured in stripes-core. Rather than putting a
longer cap on the timeout, I think the best option is to just act like
fetch and wait indefinitely until the requests return.

https://github.com/folio-org/stripes-core/blob/6afa0d761aac4f4d00073a781072ae3ec0c8f6dd/doc/okapiKy.md#timeouts
describes this precisely.

Refs UIIN-2006
  • Loading branch information
zburke authored and mkuklis committed Apr 12, 2022
1 parent 54ce442 commit e329768
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/hooks/useHoldingItemsQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const useHoldingItemsQuery = (
holdingsRecordId,
options = { searchParams: {}, key: 'items' },
) => {
const ky = useOkapiKy();
const ky = useOkapiKy().extend({ timeout: false });
const [namespace] = useNamespace();
const queryKey = [namespace, options.key, holdingsRecordId];
const defaultSearchParams = {
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useHoldingItemsQuery.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('useHoldingItemsQuery', () => {
beforeEach(() => {
useOkapiKy.mockClear().mockReturnValue({
get: mockGet,
extend: jest.fn().mockReturnValue({ get: mockGet }),
});
});

Expand Down

0 comments on commit e329768

Please sign in to comment.