not-an-aardvark / snoowrap

A JavaScript wrapper for the reddit API
MIT License
1.01k stars 125 forks source link

Get user name of parent comment take too long time #336

Closed tnm0113 closed 3 years ago

tnm0113 commented 3 years ago

Hi, I'm currently using snoowrap with snoostorm for crawling comment from reddit. I have a problem when get username of parent comment. I use await client.getComment(item.parent_id).author.name; to get the username. But it seems the request takes too long to get the result. I notify that the longer time the bot run, the longer time to get the response, so i think may be the request is pushed in a very long queue ? The block code i use with snoostorm:

   const inbox = new InboxStream(client, {
      filter: "mentions" | "messages",
      limit: 10,
      pollTime: 2000,
  });

  const comments = new CommentStream(client, {
      subreddit: botConfig.subreddit,
      limit: 10,
      pollTime: 2000,
  })

If anyone have same issue please help me with this, Tks

Venefilyn commented 3 years ago

Hi,

This sounds like a rate limit issue. When you are being ratelimited, Snoowrap simply waits with the request for the duration of the rate limit expiration. You should reduce the amount of requests you make

If you rather want snoowrap to throw a RateLimitError exception when ratelimit is hit you can set continueAfterRatelimitError to false

r.config({continueAfterRatelimitError: false})