laravel-envoyer-sdk icon indicating copy to clipboard operation
laravel-envoyer-sdk copied to clipboard

Rate limiting by Envoyer is triggered, but not handled properly

Open mike503 opened this issue 3 years ago • 1 comments

This quick loop to get a list of all collaborators on all projects winds up hitting some sort of rate limit (silently)

I have 78 projects, so this would be a total of 79 API calls. Seems like when it hits project #60 (so it's done 60 API calls back to back, I believe) it starts coming back empty. It doesn't seem to throw an exception that I can trap. I can't imagine Envoyer itself is responding with a 200 and empty result, instead of a 524 / some non-200 response.

To reproduce, have over 60 projects and run this:

$i = 1;
$collabs = array();
foreach ($envoyer->projects->all()->projects as $project) {
  echo "{$i}. {$project->name}\n";
  $j = 1;
  foreach ($envoyer->collaborators->on($project->id)->all()->collaborators as $collab) {
    echo "  {$j}. got a collab {$collab->email}\n";
    $j++;
  }
  $i++;
  // sleep(3) here does space it out enough...
}

adding in sleep(3) was enough between the collaborators call for it to work, so it slows things down "enough"

But the fact it was silently returning what appeared to be a legitimately empty result I did not catch until I was actually doing something and realized my script was lying to me.

mike503 avatar Jan 14 '22 00:01 mike503

I am actually looking into how I can manage this in general at the moment, both myself and Sam Carre are looking at what we can do for PHP HTTP and rate limiting and retrying

JustSteveKing avatar May 31 '22 08:05 JustSteveKing