Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Commits on Source (2)
(chore): Appeals loop and awaiting TTL (#463)
· 23f0c499
Emiliano Balbuena
authored
May 28, 2019
and
Mark Harding
committed
May 28, 2019
23f0c499
Merge branch 'hotfix/appeal-summons-tweaks-1' into 'master'
· 5b0ef158
Mark Harding
authored
May 28, 2019
(chore): Appeals loop and awaiting TTL (#463) See merge request
minds/engine!180
5b0ef158
Hide whitespace changes
Inline
Side-by-side
Core/Queue/Runners/ReportsAppealSummon.php
View file @
5b0ef158
...
...
@@ -51,8 +51,8 @@ class ReportsAppealSummon implements QueueRunner
'include_only'
=>
$cohort
?:
null
,
]);
if
(
$missing
>
0
)
{
echo
"
Missing
{
$missing
}
juror(s). Deferring..."
.
PHP_EOL
;
if
(
$missing
>
0
||
$appeal
->
getReport
()
->
getState
()
===
'appealed'
)
{
echo
"
There are
{
$missing
}
juror(s). Deferring
until case is out of `appealed` state
..."
.
PHP_EOL
;
$manager
->
defer
(
$appeal
);
}
...
...
Core/Reports/Summons/Manager.php
View file @
5b0ef158
...
...
@@ -70,7 +70,7 @@ class Manager
'include_only'
=>
null
,
'active_threshold'
=>
5
*
60
,
'jury_size'
=>
12
,
'awaiting_ttl'
=>
12
0
,
'awaiting_ttl'
=>
30
0
,
],
$opts
);
// Get a fresh report to collect completed jurors
...
...
@@ -99,7 +99,7 @@ class Manager
// Check how many are missing
$missing
=
$opts
[
'jury_size'
]
-
count
(
array_filter
(
$summonses
,
function
(
Summons
$summons
)
{
return
$summons
->
isAccepted
()
||
$summons
->
isAwaiting
()
;
return
$summons
->
isAccepted
();
}));
// If we have a full jury, don't summon
...
...
@@ -108,6 +108,12 @@ class Manager
return
0
;
}
// Check how many accepted or are awaiting, it's needed to know the approximate pool size
$poolSize
=
$opts
[
'jury_size'
]
-
count
(
array_filter
(
$summonses
,
function
(
Summons
$summons
)
{
return
$summons
->
isAccepted
()
||
$summons
->
isAwaiting
();
}));
// Create an array of channel GUIDs that are involved in this case
$alreadyInvolvedGuids
=
array_map
(
function
(
Summons
$summons
)
{
...
...
@@ -127,7 +133,7 @@ class Manager
// Pick up to missing size
$cohort
=
$this
->
cohort
->
pick
([
'size'
=>
$
missing
,
'size'
=>
$
poolSize
,
'for'
=>
$appeal
->
getOwnerGuid
(),
'except'
=>
$alreadyInvolvedGuids
,
'except_hashes'
=>
$alreadyInvolvedPhoneHashes
,
...
...