Skip to content

Commit

Permalink
Update api.ts
Browse files Browse the repository at this point in the history
Indefinite bot fetching
  • Loading branch information
SaintPepsi authored Apr 17, 2022
1 parent 2d9452a commit b7d4f91
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/3Commas/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b7d4f91

Please sign in to comment.