mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update FederationController, add two new queues (follow, shared) to prioritize follow request handling
This commit is contained in:
parent
5d2614e086
commit
8ba338640f
2 changed files with 12 additions and 6 deletions
|
@ -166,17 +166,19 @@ class FederationController extends Controller
|
||||||
if(Cache::get($lockKey) !== null) {
|
if(Cache::get($lockKey) !== null) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
Cache::put($lockKey, 1, 3600);
|
Cache::put($lockKey, 1, 43200);
|
||||||
usleep(5000);
|
usleep(5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dispatch(new DeleteWorker($headers, $payload))->onQueue('delete');
|
dispatch(new DeleteWorker($headers, $payload))->onQueue('delete');
|
||||||
|
} else if( isset($obj['type']) && in_array($obj['type'], ['Follow', 'Accept'])) {
|
||||||
|
dispatch(new InboxValidator($username, $headers, $payload))->onQueue('follow');
|
||||||
} else {
|
} else {
|
||||||
$lockKey = 'pf:ap:user-inbox:activity:' . hash('sha256', $obj['id']);
|
$lockKey = 'pf:ap:user-inbox:activity:' . hash('sha256', $obj['id']);
|
||||||
if(Cache::get($lockKey) !== null) {
|
if(Cache::get($lockKey) !== null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Cache::put($lockKey, 1, 3600);
|
Cache::put($lockKey, 1, 43200);
|
||||||
usleep(5000);
|
usleep(5000);
|
||||||
dispatch(new InboxValidator($username, $headers, $payload))->onQueue('high');
|
dispatch(new InboxValidator($username, $headers, $payload))->onQueue('high');
|
||||||
}
|
}
|
||||||
|
@ -219,10 +221,12 @@ class FederationController extends Controller
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Cache::put($lockKey, 1, 3600);
|
Cache::put($lockKey, 1, 43200);
|
||||||
dispatch(new DeleteWorker($headers, $payload))->onQueue('delete');
|
dispatch(new DeleteWorker($headers, $payload))->onQueue('delete');
|
||||||
|
} else if( isset($obj['type']) && in_array($obj['type'], ['Follow', 'Accept'])) {
|
||||||
|
dispatch(new InboxWorker($headers, $payload))->onQueue('follow');
|
||||||
} else {
|
} else {
|
||||||
dispatch(new InboxWorker($headers, $payload))->onQueue('high');
|
dispatch(new InboxWorker($headers, $payload))->onQueue('shared');
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,8 @@ return [
|
||||||
|
|
||||||
'waits' => [
|
'waits' => [
|
||||||
'redis:feed' => 30,
|
'redis:feed' => 30,
|
||||||
|
'redis:follow' => 30,
|
||||||
|
'redis:shared' => 30,
|
||||||
'redis:default' => 30,
|
'redis:default' => 30,
|
||||||
'redis:low' => 30,
|
'redis:low' => 30,
|
||||||
'redis:high' => 30,
|
'redis:high' => 30,
|
||||||
|
@ -169,7 +171,7 @@ return [
|
||||||
'production' => [
|
'production' => [
|
||||||
'supervisor-1' => [
|
'supervisor-1' => [
|
||||||
'connection' => 'redis',
|
'connection' => 'redis',
|
||||||
'queue' => ['high', 'default', 'feed', 'low', 'story', 'delete', 'mmo'],
|
'queue' => ['high', 'default', 'follow', 'shared', '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),
|
||||||
|
@ -183,7 +185,7 @@ return [
|
||||||
'local' => [
|
'local' => [
|
||||||
'supervisor-1' => [
|
'supervisor-1' => [
|
||||||
'connection' => 'redis',
|
'connection' => 'redis',
|
||||||
'queue' => ['high', 'default', 'feed', 'low', 'story', 'delete', 'mmo'],
|
'queue' => ['high', 'default', 'follow', 'shared', 'feed', 'low', 'story', 'delete', 'mmo'],
|
||||||
'balance' => 'auto',
|
'balance' => 'auto',
|
||||||
'minProcesses' => 1,
|
'minProcesses' => 1,
|
||||||
'maxProcesses' => 20,
|
'maxProcesses' => 20,
|
||||||
|
|
Loading…
Reference in a new issue