added retries back to mail functionality
This commit is contained in:
@@ -37,10 +37,10 @@ class ProcessSendEveMailJob implements ShouldQueue
|
||||
|
||||
/**
|
||||
* Retries
|
||||
* With new rate limiting, we shouldn't use this timeout
|
||||
* With new rate limiting, we need a retry basis versus timeout basis
|
||||
* @var int
|
||||
*/
|
||||
//public $retries = 3;
|
||||
public $retries = 5;
|
||||
|
||||
private $sender;
|
||||
private $body;
|
||||
@@ -166,6 +166,9 @@ class ProcessSendEveMailJob implements ShouldQueue
|
||||
|
||||
//Allow 4 jobs per minute, and implement a rate limited backoff on failed jobs
|
||||
$rateLimitedMiddleware = (new RateLimited())
|
||||
->enabled()
|
||||
->key('psemj')
|
||||
->connectionName('redis')
|
||||
->allow(4)
|
||||
->everySeconds(60)
|
||||
->releaseAfterOneMinute()
|
||||
|
||||
@@ -42,13 +42,6 @@ class ProcessSendEveMailJobRL implements ShouldQueue
|
||||
*/
|
||||
//public $retries = 3;
|
||||
|
||||
/**
|
||||
* Middleware for the job
|
||||
*
|
||||
* @var \Spatie\RateLimitedMiddleware\RateLimited
|
||||
*/
|
||||
private $middleware;
|
||||
|
||||
private $sender;
|
||||
private $body;
|
||||
private $recipient;
|
||||
@@ -127,8 +120,10 @@ class ProcessSendEveMailJobRL implements ShouldQueue
|
||||
*/
|
||||
public function middleware() {
|
||||
|
||||
//Allow 4 jobs per minute, and implement a rate limited backoff on failed jobs
|
||||
$rateLimitedMiddleware = (new RateLimited())
|
||||
->enabled()
|
||||
->key('PSEMJ')
|
||||
->connectionName('redis')
|
||||
->allow(4)
|
||||
->everySeconds(60)
|
||||
->releaseAfterOneMinute()
|
||||
@@ -137,6 +132,27 @@ class ProcessSendEveMailJobRL implements ShouldQueue
|
||||
return [$rateLimitedMiddleware];
|
||||
}
|
||||
|
||||
private function OtherCode() {
|
||||
//Can also specify middleware when dispatch a job.
|
||||
//SomeJob::dispatch()->through([new SomeMiddleware]);
|
||||
|
||||
//Current method of creating job handle with redis throttle
|
||||
/**
|
||||
* public function handle()
|
||||
* {
|
||||
* Redis::throttle('key')->allow(10)->every(60)->then(function () {
|
||||
* // Job logic...
|
||||
* }, function () {
|
||||
* // Could not obtain lock...
|
||||
* return $this->release(10);
|
||||
* });
|
||||
* }
|
||||
*/
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine the time at which the job should timeout.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user