We are now setting the corresponding worker id
This commit is contained in:
@@ -294,7 +294,8 @@ class Processor
|
||||
if ($fetch_by_worker) {
|
||||
Logger::notice('Fetching is done by worker.', ['parent' => $activity['reply-to-id'], 'recursion-depth' => $recursion_depth]);
|
||||
$activity['recursion-depth'] = 0;
|
||||
Worker::add(PRIORITY_HIGH, 'FetchMissingActivity', $activity['reply-to-id'], $activity, '', Receiver::COMPLETION_AUTO);
|
||||
$wid = Worker::add(PRIORITY_HIGH, 'FetchMissingActivity', $activity['reply-to-id'], $activity, '', Receiver::COMPLETION_AUTO);
|
||||
Queue::setWorkerId($activity, $wid);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +89,21 @@ class Queue
|
||||
DBA::delete('inbox-entry', ['id' => $activity['entry-id']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the worker id for the queue entry
|
||||
*
|
||||
* @param array $activity
|
||||
* @param int $wid
|
||||
* @return void
|
||||
*/
|
||||
public static function setWorkerId(array $activity, int $wid)
|
||||
{
|
||||
if (empty($activity['entry-id']) || empty($wid)) {
|
||||
return;
|
||||
}
|
||||
DBA::update('inbox-entry', ['wid' => $wid], ['id' => $activity['entry-id']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the activity with the given id
|
||||
*
|
||||
@@ -129,7 +144,7 @@ class Queue
|
||||
}
|
||||
|
||||
/**
|
||||
* Process all activities
|
||||
* Clear old activities
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user