Skip to content

Commit

Permalink
fix: add download jitter (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio authored Nov 24, 2024
1 parent ca164ad commit 6907207
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/Models/ScheduledJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ public function getPreparedSourceUrl(array $map = []): string

public function fetchSource(array $map = []): Response
{
// Jitter to prevent rate limiting
usleep(1000 * rand(1, 256));

return Http::createPendingRequest()
->when($this->requiresAuthentication(), function (PendingRequest $request) {
return $request->withBasicAuth($this->source_username, $this->source_password);
Expand Down

0 comments on commit 6907207

Please sign in to comment.