mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-26 09:46:49 +00:00
Merge pull request #3939 from pixelfed/staging
Update InboxPipeline, add inbox job queue and separate http sig valid…
This commit is contained in:
commit
6e2e718872
6 changed files with 54 additions and 5 deletions
|
@ -52,6 +52,7 @@
|
||||||
- Dispatch follow accept/reject pipeline jobs to follow queue ([aaed2bf6](https://github.com/pixelfed/pixelfed/commit/aaed2bf6))
|
- Dispatch follow accept/reject pipeline jobs to follow queue ([aaed2bf6](https://github.com/pixelfed/pixelfed/commit/aaed2bf6))
|
||||||
- Update MediaStorageService, improve support for pleroma .blob avatars ([66226658](https://github.com/pixelfed/pixelfed/commit/66226658))
|
- Update MediaStorageService, improve support for pleroma .blob avatars ([66226658](https://github.com/pixelfed/pixelfed/commit/66226658))
|
||||||
- Update ApiV1Controller, remove min avatar size limit, fixes #3715 ([2b0db812](https://github.com/pixelfed/pixelfed/commit/2b0db812))
|
- Update ApiV1Controller, remove min avatar size limit, fixes #3715 ([2b0db812](https://github.com/pixelfed/pixelfed/commit/2b0db812))
|
||||||
|
- Update InboxPipeline, add inbox job queue and separate http sig validation from activity handling ([e6c1604d](https://github.com/pixelfed/pixelfed/commit/e6c1604d))
|
||||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||||
|
|
||||||
## [v0.11.4 (2022-10-04)](https://github.com/pixelfed/pixelfed/compare/v0.11.3...v0.11.4)
|
## [v0.11.4 (2022-10-04)](https://github.com/pixelfed/pixelfed/compare/v0.11.3...v0.11.4)
|
||||||
|
|
47
app/Jobs/InboxPipeline/ActivityHandler.php
Normal file
47
app/Jobs/InboxPipeline/ActivityHandler.php
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Jobs\InboxPipeline;
|
||||||
|
|
||||||
|
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\Inbox;
|
||||||
|
|
||||||
|
class ActivityHandler implements ShouldQueue
|
||||||
|
{
|
||||||
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
|
protected $username;
|
||||||
|
protected $headers;
|
||||||
|
protected $payload;
|
||||||
|
|
||||||
|
public $timeout = 300;
|
||||||
|
public $tries = 1;
|
||||||
|
public $maxExceptions = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new job instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct($headers, $username, $payload)
|
||||||
|
{
|
||||||
|
$this->username = $username;
|
||||||
|
$this->headers = $headers;
|
||||||
|
$this->payload = $payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the job.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
(new Inbox($this->headers, $this->username, $this->payload))->handle();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
|
@ -105,7 +105,7 @@ class DeleteWorker implements ShouldQueue
|
||||||
$profile = null;
|
$profile = null;
|
||||||
|
|
||||||
if($this->verifySignature($headers, $payload) == true) {
|
if($this->verifySignature($headers, $payload) == true) {
|
||||||
(new Inbox($headers, $profile, $payload))->handle();
|
ActivityHandler::dispatch($headers, $profile, $payload)->onQueue('delete');
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -78,7 +78,7 @@ class InboxValidator implements ShouldQueue
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->verifySignature($headers, $profile, $payload) == true) {
|
if($this->verifySignature($headers, $profile, $payload) == true) {
|
||||||
(new Inbox($headers, $profile, $payload))->handle();
|
ActivityHandler::dispatch($headers, $profile, $payload)->onQueue('inbox');
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -66,7 +66,7 @@ class InboxWorker implements ShouldQueue
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->verifySignature($headers, $payload) == true) {
|
if($this->verifySignature($headers, $payload) == true) {
|
||||||
(new Inbox($headers, $profile, $payload))->handle();
|
ActivityHandler::dispatch($headers, $profile, $payload)->onQueue('inbox');
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -83,6 +83,7 @@ return [
|
||||||
'redis:follow' => 30,
|
'redis:follow' => 30,
|
||||||
'redis:shared' => 30,
|
'redis:shared' => 30,
|
||||||
'redis:default' => 30,
|
'redis:default' => 30,
|
||||||
|
'redis:inbox' => 30,
|
||||||
'redis:low' => 30,
|
'redis:low' => 30,
|
||||||
'redis:high' => 30,
|
'redis:high' => 30,
|
||||||
'redis:delete' => 30,
|
'redis:delete' => 30,
|
||||||
|
@ -171,7 +172,7 @@ return [
|
||||||
'production' => [
|
'production' => [
|
||||||
'supervisor-1' => [
|
'supervisor-1' => [
|
||||||
'connection' => 'redis',
|
'connection' => 'redis',
|
||||||
'queue' => ['high', 'default', 'follow', 'shared', 'feed', 'low', 'story', 'delete', 'mmo'],
|
'queue' => ['high', 'default', 'follow', 'shared', 'inbox', 'feed', 'low', 'story', 'delete', 'mmo'],
|
||||||
'balance' => env('HORIZON_BALANCE_STRATEGY', 'auto'),
|
'balance' => env('HORIZON_BALANCE_STRATEGY', 'auto'),
|
||||||
'minProcesses' => env('HORIZON_MIN_PROCESSES', 1),
|
'minProcesses' => env('HORIZON_MIN_PROCESSES', 1),
|
||||||
'maxProcesses' => env('HORIZON_MAX_PROCESSES', 20),
|
'maxProcesses' => env('HORIZON_MAX_PROCESSES', 20),
|
||||||
|
@ -185,7 +186,7 @@ return [
|
||||||
'local' => [
|
'local' => [
|
||||||
'supervisor-1' => [
|
'supervisor-1' => [
|
||||||
'connection' => 'redis',
|
'connection' => 'redis',
|
||||||
'queue' => ['high', 'default', 'follow', 'shared', 'feed', 'low', 'story', 'delete', 'mmo'],
|
'queue' => ['high', 'default', 'follow', 'shared', 'inbox', 'feed', 'low', 'story', 'delete', 'mmo'],
|
||||||
'balance' => 'auto',
|
'balance' => 'auto',
|
||||||
'minProcesses' => 1,
|
'minProcesses' => 1,
|
||||||
'maxProcesses' => 20,
|
'maxProcesses' => 20,
|
||||||
|
|
Loading…
Reference in a new issue