Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

246
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda