mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update DirectMessageController, dispatch deliver and delete actions to the job queue
This commit is contained in:
parent
d848792ad4
commit
7f462a8055
3 changed files with 88 additions and 3 deletions
|
@ -23,6 +23,8 @@ use App\Services\AccountService;
|
||||||
use App\Services\StatusService;
|
use App\Services\StatusService;
|
||||||
use App\Services\WebfingerService;
|
use App\Services\WebfingerService;
|
||||||
use App\Models\Conversation;
|
use App\Models\Conversation;
|
||||||
|
use App\Jobs\DirectPipeline\DirectDeletePipeline;
|
||||||
|
use App\Jobs\DirectPipeline\DirectDeliverPipeline;
|
||||||
|
|
||||||
class DirectMessageController extends Controller
|
class DirectMessageController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -829,7 +831,7 @@ class DirectMessageController extends Controller
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
Helpers::sendSignedObject($profile, $url, $body);
|
DirectDeliverPipeline::dispatch($profile, $url, $body)->onQueue('high');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function remoteDelete($dm)
|
public function remoteDelete($dm)
|
||||||
|
@ -852,7 +854,6 @@ class DirectMessageController extends Controller
|
||||||
'type' => 'Tombstone'
|
'type' => 'Tombstone'
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
DirectDeletePipeline::dispatch($profile, $url, $body)->onQueue('high');
|
||||||
Helpers::sendSignedObject($profile, $url, $body);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
42
app/Jobs/DirectPipeline/DirectDeletePipeline.php
Normal file
42
app/Jobs/DirectPipeline/DirectDeletePipeline.php
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Jobs\DirectPipeline;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use App\Util\ActivityPub\Helpers;
|
||||||
|
|
||||||
|
class DirectDeletePipeline implements ShouldQueue
|
||||||
|
{
|
||||||
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $timeout = 900;
|
||||||
|
public $tries = 3;
|
||||||
|
public $maxExceptions = 1;
|
||||||
|
|
||||||
|
protected $profile;
|
||||||
|
protected $url;
|
||||||
|
protected $payload;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new job instance.
|
||||||
|
*/
|
||||||
|
public function __construct($profile, $url, $payload)
|
||||||
|
{
|
||||||
|
$this->profile = $profile;
|
||||||
|
$this->url = $url;
|
||||||
|
$this->payload = $payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the job.
|
||||||
|
*/
|
||||||
|
public function handle(): void
|
||||||
|
{
|
||||||
|
Helpers::sendSignedObject($this->profile, $this->url, $this->payload);
|
||||||
|
}
|
||||||
|
}
|
42
app/Jobs/DirectPipeline/DirectDeliverPipeline.php
Normal file
42
app/Jobs/DirectPipeline/DirectDeliverPipeline.php
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Jobs\DirectPipeline;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use App\Util\ActivityPub\Helpers;
|
||||||
|
|
||||||
|
class DirectDeliverPipeline implements ShouldQueue
|
||||||
|
{
|
||||||
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $timeout = 900;
|
||||||
|
public $tries = 3;
|
||||||
|
public $maxExceptions = 1;
|
||||||
|
|
||||||
|
protected $profile;
|
||||||
|
protected $url;
|
||||||
|
protected $payload;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new job instance.
|
||||||
|
*/
|
||||||
|
public function __construct($profile, $url, $payload)
|
||||||
|
{
|
||||||
|
$this->profile = $profile;
|
||||||
|
$this->url = $url;
|
||||||
|
$this->payload = $payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the job.
|
||||||
|
*/
|
||||||
|
public function handle(): void
|
||||||
|
{
|
||||||
|
Helpers::sendSignedObject($this->profile, $this->url, $this->payload);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue