Update MovePipeline

This commit is contained in:
Daniel Supernault 2024-09-09 02:00:27 -06:00
parent 375137bf75
commit 12a0d2e8bf
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1
2 changed files with 26 additions and 10 deletions

View file

@ -12,7 +12,7 @@ use GuzzleHttp\Client;
use GuzzleHttp\Pool; use GuzzleHttp\Pool;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable; use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Queue\Middleware\ThrottlesExceptions; use Illuminate\Queue\Middleware\ThrottlesExceptionsWithRedis;
use Illuminate\Queue\Middleware\WithoutOverlapping; use Illuminate\Queue\Middleware\WithoutOverlapping;
class MoveMigrateFollowersPipeline implements ShouldQueue class MoveMigrateFollowersPipeline implements ShouldQueue
@ -28,14 +28,21 @@ class MoveMigrateFollowersPipeline implements ShouldQueue
* *
* @var int * @var int
*/ */
public $tries = 6; public $tries = 15;
/** /**
* The maximum number of unhandled exceptions to allow before failing. * The maximum number of unhandled exceptions to allow before failing.
* *
* @var int * @var int
*/ */
public $maxExceptions = 3; public $maxExceptions = 5;
/**
* The number of seconds the job can run before timing out.
*
* @var int
*/
public $timeout = 900;
/** /**
* Create a new job instance. * Create a new job instance.
@ -55,7 +62,7 @@ class MoveMigrateFollowersPipeline implements ShouldQueue
{ {
return [ return [
new WithoutOverlapping('process-move-migrate-followers:'.$this->target), new WithoutOverlapping('process-move-migrate-followers:'.$this->target),
(new ThrottlesExceptions(2, 5 * 60))->backoff(5), (new ThrottlesExceptionsWithRedis(5, 2 * 60))->backoff(1),
]; ];
} }
@ -64,7 +71,7 @@ class MoveMigrateFollowersPipeline implements ShouldQueue
*/ */
public function retryUntil(): DateTime public function retryUntil(): DateTime
{ {
return now()->addMinutes(5); return now()->addMinutes(15);
} }
/** /**

View file

@ -8,7 +8,7 @@ use DateTime;
use Exception; use Exception;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable; use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Queue\Middleware\ThrottlesExceptions; use Illuminate\Queue\Middleware\ThrottlesExceptionsWithRedis;
use Illuminate\Queue\Middleware\WithoutOverlapping; use Illuminate\Queue\Middleware\WithoutOverlapping;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Log; use Log;
@ -26,14 +26,21 @@ class ProcessMovePipeline implements ShouldQueue
* *
* @var int * @var int
*/ */
public $tries = 6; public $tries = 15;
/** /**
* The maximum number of unhandled exceptions to allow before failing. * The maximum number of unhandled exceptions to allow before failing.
* *
* @var int * @var int
*/ */
public $maxExceptions = 3; public $maxExceptions = 5;
/**
* The number of seconds the job can run before timing out.
*
* @var int
*/
public $timeout = 120;
/** /**
* Create a new job instance. * Create a new job instance.
@ -53,7 +60,7 @@ class ProcessMovePipeline implements ShouldQueue
{ {
return [ return [
new WithoutOverlapping('process-move:'.$this->target), new WithoutOverlapping('process-move:'.$this->target),
(new ThrottlesExceptions(2, 5 * 60))->backoff(5), (new ThrottlesExceptionsWithRedis(5, 2 * 60))->backoff(1),
]; ];
} }
@ -62,7 +69,7 @@ class ProcessMovePipeline implements ShouldQueue
*/ */
public function retryUntil(): DateTime public function retryUntil(): DateTime
{ {
return now()->addMinutes(5); return now()->addMinutes(10);
} }
/** /**
@ -132,6 +139,8 @@ class ProcessMovePipeline implements ShouldQueue
if (! $res || ! isset($res['movedTo']) || empty($res['movedTo'])) { if (! $res || ! isset($res['movedTo']) || empty($res['movedTo'])) {
Log::info('[AP][INBOX][MOVE] actor_movedTo failure'); Log::info('[AP][INBOX][MOVE] actor_movedTo failure');
$payload = json_encode($res, JSON_PRETTY_PRINT);
Log::info($payload);
return false; return false;
} }