Fix in process count

This commit is contained in:
DariusIII
2026-06-04 09:54:43 +02:00
parent e742c22a39
commit a8f79c05b1
2 changed files with 22 additions and 19 deletions
+13 -19
View File
@@ -356,27 +356,21 @@ class Tmux
);
case 2:
$ppminString = $ppmaxString = '';
if (is_numeric($ppmax) && ! empty($ppmax)) {
$ppmax *= 1073741824;
$ppmaxString = "AND r.size < {$ppmax}";
}
if (is_numeric($ppmin) && ! empty($ppmin)) {
$ppmin *= 1048576;
$ppminString = "AND r.size > {$ppmin}";
}
// NOTE: the "Misc In Process" / `work` count was previously computed here
// and repeatedly drifted out of sync with the actual additional
// post-processor selection in
// \App\Services\AdditionalProcessing\AdditionalCandidateQuery::applyPredicates()
// (typical drift: a missing `nzbstatus = 1` filter, which leaves
// NZB-less releases stuck in the queue forever). It now lives in
// \App\Services\Tmux\TmuxMonitorService::collectProcessCounts(), which
// calls AdditionalCandidateQuery directly. The $ppmax / $ppmin args
// are kept for backward compatibility with the public signature but
// are no longer used by this case.
unset($ppmax, $ppmin);
return "SELECT
(SELECT COUNT(r.id) FROM releases r
LEFT JOIN categories c ON c.id = r.categories_id
WHERE r.passwordstatus = -1
AND r.haspreview = -1
{$ppminString}
{$ppmaxString}
AND c.disablepreview = 0
) AS work,
return 'SELECT
(SELECT COUNT(id) FROM usenet_groups WHERE active = 1) AS active_groups,
(SELECT COUNT(id) FROM usenet_groups WHERE name IS NOT NULL) AS all_groups";
(SELECT COUNT(id) FROM usenet_groups WHERE name IS NOT NULL) AS all_groups';
case 4:
return sprintf(
+9
View File
@@ -8,6 +8,7 @@ use App\Models\Category;
use App\Models\Collection;
use App\Models\Release;
use App\Models\Settings;
use App\Services\AdditionalProcessing\AdditionalCandidateQuery;
use Illuminate\Support\Facades\DB;
/**
@@ -242,6 +243,14 @@ class TmuxMonitorService
}
}
// "Misc In Process" / `work` is computed via AdditionalCandidateQuery so
// the dashboard counter is guaranteed to match exactly what the
// additional post-processor will pick up. Previously this was an
// inline SQL fragment inside Tmux::proc_query(2) which kept drifting
// (e.g. missing `nzbstatus = 1`) and left releases stuck in the queue
// forever. Do NOT re-introduce a separate predicate here.
$this->runVar['counts']['now']['work'] = AdditionalCandidateQuery::baseBuilder()->count();
$this->runVar['timers']['query']['proc2_time'] = time() - $timer2;
} catch (\Exception $e) {