Skip to content

Commit

Permalink
Change "retry until"-value and rate limiting for Lightspeed jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
timothy committed Apr 29, 2021
1 parent 89cf2eb commit ae63a6b
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/Jobs/SendResourceToLightspeedRetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ class SendResourceToLightspeedRetail implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

/*
* Times the job will be retried
*/
public $tries = 5;

/*
* The number of seconds to wait before retrying the job
*/
public $retryAfter = 10;

private Model $model;
private string $resource;
private array $payload;
Expand Down Expand Up @@ -210,7 +200,12 @@ public function middleware(): array
}

return [
new RateLimited('ls-retail-api-throttle'),
new RateLimited('ls-retail-api-throttle', 1, 10, 5 * $this->attempts()),
];
}

public function retryUntil()
{
return now()->addDay();
}
}

0 comments on commit ae63a6b

Please sign in to comment.