Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

139
Views
Issue with Promise.allSettled()

I built an application that periodically calls the Twitter API to retrieve tweets for 200 different keywords and store them in a database.

For this purpose, I use the Twitter for Node.js package:

twitterClient.get('search/tweets', {
  q : '$' + keyword,
  result_type : 'recent',
  count : '100'
}

The whole process takes about 4 minutes when performed sequentially.

So I would like to make the Twitter API calls in parallel using Promise.allSettled() to improve performance.

This way the process is much faster (about 20 seconds). The problem is that it causes a lot of errors like "Error: JSON parseError with HTTP Status: 200 OK". So about 25 calls fail.

Why does this happen? How can I solve this problem?

EDIT

I already use Promise.allSettled() to periodically retrieve info about 200 different users:

twitterClient.get('users/show', {
  screen_name: userTwitterName
}

In this case I don't have any issue.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!