Skip to content

Commit

Permalink
1000 chunk size, 500ms
Browse files Browse the repository at this point in the history
  • Loading branch information
th0rgall committed Mar 13, 2024
1 parent 37b0e84 commit a74c241
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 = 500;
const CHUNK_SIZE = 1000;
// 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(), 1500));
await new Promise<void>((resolve) => setTimeout(() => resolve(), 500));
} while (startAfterDoc != null && iteration < LOOP_LIMIT_ITEMS / CHUNK_SIZE);

isFetchingGardens.set(false);
Expand Down

0 comments on commit a74c241

Please sign in to comment.