Skip to content

Commit

Permalink
chunk size 250, no delay
Browse files Browse the repository at this point in the history
  • Loading branch information
th0rgall committed Mar 13, 2024
1 parent a74c241 commit 8d69fd6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/api/garden.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const getGarden = async (id: string) => {
};

export const getAllListedGardens = async () => {
const CHUNK_SIZE = 1000;
const CHUNK_SIZE = 250;
// To prevent endless loops in case of unexpected problems or bugs
// Note: this leads to the loop breaking once this number of gardens is reached!
const LOOP_LIMIT_ITEMS = 100000;
Expand Down Expand Up @@ -81,7 +81,7 @@ export const getAllListedGardens = async () => {
);

// Wait 1000ms seconds before fetching the next chunk
await new Promise<void>((resolve) => setTimeout(() => resolve(), 500));
// await new Promise<void>((resolve) => setTimeout(() => resolve()));
} while (startAfterDoc != null && iteration < LOOP_LIMIT_ITEMS / CHUNK_SIZE);

isFetchingGardens.set(false);
Expand Down

0 comments on commit 8d69fd6

Please sign in to comment.