diff --git a/app/Services/Tmux/Tmux.php b/app/Services/Tmux/Tmux.php index f7b433d2e..d429962cc 100644 --- a/app/Services/Tmux/Tmux.php +++ b/app/Services/Tmux/Tmux.php @@ -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( diff --git a/app/Services/Tmux/TmuxMonitorService.php b/app/Services/Tmux/TmuxMonitorService.php index e2623370b..f74eed055 100644 --- a/app/Services/Tmux/TmuxMonitorService.php +++ b/app/Services/Tmux/TmuxMonitorService.php @@ -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) {