Skip to content

Commit

Permalink
use separate delay for image downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
hfxbse committed May 4, 2024
1 parent cdebd29 commit b4f0329
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ try {
},
parallelTasks: 20,
delay: {
images: {
upper: 5000,
lower: 500
},
pages: {
upper: 40000,
lower: 20000
Expand Down
5 changes: 1 addition & 4 deletions src/instagram/follower.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,7 @@ async function fetchFollowers({session, user, page, direction, limits}: {
profile: {
username: user.username,
name: user.full_name,
image: randomDelay({
lower: 0,
upper: limits.rate.delay.pages.upper
}).delay.then(() => downloadProfilePicture(user.profile_pic_url))
image: randomDelay(limits.rate.delay.images).delay.then(() => downloadProfilePicture(user.profile_pic_url))
},
public: !user.is_private,
private: user.is_private && id != session.user.id
Expand Down
1 change: 1 addition & 0 deletions src/instagram/limits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface Limits {
}
parallelTasks: number
delay: {
images: RandomDelayLimit,
daily: RandomDelayLimit,
batches: RandomDelayLimit,
pages: RandomDelayLimit
Expand Down

0 comments on commit b4f0329

Please sign in to comment.