From b7d4f914f514772b88ea5a3efabede19102f5fa5 Mon Sep 17 00:00:00 2001 From: Ian Hogers Date: Mon, 18 Apr 2022 09:09:30 +1000 Subject: [PATCH] Update api.ts Indefinite bot fetching --- src/main/3Commas/api.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/3Commas/api.ts b/src/main/3Commas/api.ts index 581f9120..2c43900f 100644 --- a/src/main/3Commas/api.ts +++ b/src/main/3Commas/api.ts @@ -49,10 +49,10 @@ async function bots(profileData: Type_Profile) { let responseArray = []; let response: Bots[]; - let offsetMax = 5000; let perOffset = 100; - - for (let offset = 0; offset < offsetMax; offset += perOffset) { + + // Fetch bots indefinitely until server has no more bots to provide. + for (let offset = 0; true; offset += perOffset) { response = await api.getBots({ limit: 100, sort_by: 'updated_at', sort_direction: 'desc', offset }); if (response.length > 0) { responseArray.push(...response) } if (response.length != perOffset) break