Commit b6774038 authored by Mark Harding's avatar Mark Harding

(fix): some fixes to jury summons process

parent 5481a5d9
No related merge requests found
Pipeline #67790325 failed with stages
in 4 minutes and 44 seconds
......@@ -43,10 +43,20 @@ class ReportsAppealSummon implements QueueRunner
return;
}
echo "Summoning for {$appeal->getReport()->getUrn()}..." . PHP_EOL;
// Reydrate each loop
$reportsManager = Di::_()->get('Moderation\Manager');
$appeal->setReport($reportsManager->getReport($appeal->getReport()->getUrn()));
if ($appeal->getReport()->getState() !== 'appealed') {
echo "{$appeal->getReport()->getUrn()} is already appealed..." . PHP_EOL;
return;
}
echo "Summoning for {$appeal->getReport()->getUrn()}..." . PHP_EOL;
/** @var Manager $manager */
$manager = Di::_()->get('Moderation\Summons\Manager');
$missing = $manager->summon($appeal, [
'include_only' => $cohort ?: null,
]);
......
......@@ -70,7 +70,7 @@ class Manager
'include_only' => null,
'active_threshold' => 5 * 60,
'jury_size' => 12,
'awaiting_ttl' => 300,
'awaiting_ttl' => 120,
], $opts);
// Get a fresh report to collect completed jurors
......@@ -133,7 +133,7 @@ class Manager
// Pick up to missing size
$cohort = $this->cohort->pick([
'size' => $poolSize,
'size' => $poolSize * 500, // 500 users
'for' => $appeal->getOwnerGuid(),
'except' => $alreadyInvolvedGuids,
'except_hashes' => $alreadyInvolvedPhoneHashes,
......@@ -143,7 +143,11 @@ class Manager
// Build Summonses
$sent = 0;
foreach ($cohort as $juror) {
if (++$sent > $poolSize) {
break;
}
$summons = new Summons();
$summons
->setReportUrn($reportUrn)
......@@ -154,6 +158,7 @@ class Manager
$this->repository->add($summons);
$this->socketDelegate->onSummon($summons);
echo "\nSummoning $juror for $reportUrn";
}
//
......
......@@ -187,7 +187,10 @@ class Pool
$result = $this->elasticsearch->request($prepared);
foreach ($result['aggregations']['entities']['buckets'] as $bucket) {
$buckets = $result['aggregations']['entities']['buckets'];
shuffle($buckets);
echo "\n" . count($buckets) . " returned";
foreach ($buckets as $bucket) {
yield $bucket['key'];
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment