1
0
Fork 0
forked from mirror/pixelfed

Update AP deliver job

This commit is contained in:
Daniel Supernault 2019-03-07 23:39:18 -07:00
parent 4bfe30e5b5
commit 691cc991c6
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

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();