Merge pull request #988 from pixelfed/frontend-ui-refactor

Update AP deliver job
This commit is contained in:
daniel 2019-03-07 23:39:56 -07:00 committed by GitHub
commit e9021d3e50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,7 +76,7 @@ class StatusActivityPubDeliver implements ShouldQueue
'timeout' => config('pixelfed.ap_delivery_timeout') 'timeout' => config('pixelfed.ap_delivery_timeout')
]); ]);
$requests = function() use ($audience, $client, $activity, $profile, $payload) { $requests = function($audience) use ($client, $activity, $profile, $payload) {
foreach($audience as $url) { foreach($audience as $url) {
$headers = HttpSignature::sign($profile, $url, $activity); $headers = HttpSignature::sign($profile, $url, $activity);
yield function() use ($client, $url, $headers, $payload) { yield function() use ($client, $url, $headers, $payload) {
@ -91,7 +91,7 @@ class StatusActivityPubDeliver implements ShouldQueue
} }
}; };
$pool = new Pool($client, $requests, [ $pool = new Pool($client, $requests($audience), [
'concurrency' => config('pixelfed.ap_delivery_concurrency'), 'concurrency' => config('pixelfed.ap_delivery_concurrency'),
'fulfilled' => function ($response, $index) { 'fulfilled' => function ($response, $index) {
Log::info('AP:deliver:success - ' . json_encode($response)); Log::info('AP:deliver:success - ' . json_encode($response));
@ -100,6 +100,7 @@ class StatusActivityPubDeliver implements ShouldQueue
Log::info('AP:deliver:rejected - ' . json_encode($reason)); Log::info('AP:deliver:rejected - ' . json_encode($reason));
} }
]); ]);
$promise = $pool->promise(); $promise = $pool->promise();
$promise->wait(); $promise->wait();