Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instagram Post Queue for sseramemes #1455

Open
EronAlves1996 opened this issue Jan 6, 2023 · 3 comments
Open

Instagram Post Queue for sseramemes #1455

EronAlves1996 opened this issue Jan 6, 2023 · 3 comments

Comments

@EronAlves1996
Copy link
Collaborator

Feature Request

The idea is a Post Queue to schedule the posts to be published by intermittent intervals. New memes should be enqueue on the end of this Queue and posted later, following the flux of the intervals.

Why it is needed

As @arantespp pointed out on Discord, Instagram bots have a limit of activity in a time span.

Possible implementation

Two possible impls for the queue:

  1. Queue can be implemented in memory (plain js or redis).
  2. Queue can be implemented in a database.

The logic gonna follows as normal queue data structure.

The intervals can be set with setInterval by an amount of time that can be customized.

If the queue is empty, the dequeue can be ignored (maybe a try/catch block or a queue.isEmpty method) and setInterval gonna follow its flow.

Code Sample

Gonna build soon

@arantespp
Copy link
Collaborator

On Meta page, we have this message:

About Instagram-Level Rate Limiting
O limite de volume da sua conta do Instagram é variável e determinado pela análise do número de impressões na conta do Instagram em um período de 24 horas. Note que seu limite de volume não será mais determinado pelo número de usuários efetivos no aplicativo. Saiba mais
Se você atingir seu limite, nós geraremos um erro de limitação e você precisará aguardar uma atualização da cota para poder fazer outras chamadas de API.
Esta Página fornece os dados aproximados de limitação de volume dos seus cinco aplicativos do Instagram principais para ajudar você a gerenciar seus limites de volume.

How will you guarantee that the previous day's queue won't consume the quota of the current day? For instance, if you post 100 times, 50 succeed, and 50 go to the queue, how will you guarantee that those 50 won't consume the quota the next day?

@sibelius
Copy link
Owner

sibelius commented Jan 6, 2023

what about a rate limit?

how many memes per minutes?

if the meme fail, try retry in X minutes

@EronAlves1996
Copy link
Collaborator Author

Reading the details of the Graph API on Meta page, we can found details about using the API.

By the way, it seems the rate limited is computed by hour, as it says here:

As solicitações da Graph API feitas com um token de acesso de app são computadas conforme o limite de volume do app. A contagem de chamadas de um app é o número de chamadas que ele pode fazer durante uma janela de 1 hora.

One solution is, if the limit is reached and the api call returns an error, we can store new memes on queue and flush them 1 hour later (maybe?).

I want to highlight another snippet:

Os pontos de extremidade que receberem solicitações suficientes do app incluirão um cabeçalho HTTP X-App-Usage ou X-Ad-Account-Usage (para chamadas da API de Anúncios versão 3.3 e anteriores) nas respostas. O cabeçalho terá uma string formatada em JSON que descreve o uso do limite de volume atual do app.

Did the API calls are returning the X-App-Usage header on response?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants