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

237
Views
Limit calls to Facebook graph_url_engagement_count

I am getting this error, "(#613) Calls to graph_url_engagement_count have exceeded the rate of 10 calls per 3600 seconds." so I want to keep the calls to the API within the limit for a given link.

Note: That the limit of 10 calls per hour only applies to each link.

This is the function I am using:

const getFacebookStats = async (link) => {
  try {
    const resp = await axios.get(
      `https://graph.facebook.com/v12.0/?id=${link}&fields=engagement&access_token=${BEARER_TOKEN_FACEBOOK}`
    );
    return resp.data.engagement;
  } catch (err) {
    // Handle Error Here
    console.error(err);
  }
};

Any help would be much appreciated.

Thank you

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Solved this problem using LRU cache.

cache.set(link, cache.get(link) == undefined ? 1 : cache.get(link) + 1);

Everytime the link was passed onto the getFacebookStats function, the link and its count were stored in the LRU cache, if the same link was being called multiple times then its count got incremented.

In the settings of LRU cache, maxAge was set to 1 hour:

maxAge: 1000 * 60 * 60,
about 4 years ago · Juan Pablo Isaza Report
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!