Merge pull request 'fix(ci): CI config fix + 25 workers + pool starts paused' (#31) from fix/ci-filename into master

Reviewed-on: https://code.cannabrands.app/Creationshop/dispensary-scraper/pulls/31
This commit is contained in:
kelly
2025-12-11 08:47:26 +00:00
4 changed files with 13 additions and 31 deletions

View File

@@ -6,10 +6,12 @@
* task-service.ts and routes/tasks.ts. * task-service.ts and routes/tasks.ts.
* *
* State is in-memory and resets on server restart. * State is in-memory and resets on server restart.
* By default, the pool is OPEN (not paused). * By default, the pool is PAUSED (closed) - admin must explicitly start it.
* This prevents workers from immediately grabbing tasks on deploy before
* the system is ready.
*/ */
let taskPoolPaused = false; let taskPoolPaused = true;
export function isTaskPoolPaused(): boolean { export function isTaskPoolPaused(): boolean {
return taskPoolPaused; return taskPoolPaused;

View File

@@ -280,7 +280,7 @@ export default function TasksDashboard() {
> >
<div className="flex items-center gap-2 mb-2"> <div className="flex items-center gap-2 mb-2">
<span className={`p-1.5 rounded ${STATUS_COLORS[status]}`}> <span className={`p-1.5 rounded ${STATUS_COLORS[status]}`}>
{STATUS_ICONS[status]} {getStatusIcon(status, poolPaused)}
</span> </span>
<span className="text-sm font-medium text-gray-600 capitalize">{status}</span> <span className="text-sm font-medium text-gray-600 capitalize">{status}</span>
</div> </div>

View File

@@ -292,16 +292,6 @@ export function WorkersDashboard() {
} }
}, []); }, []);
// Cleanup stale workers
const handleCleanupStale = async () => {
try {
await api.post('/api/worker-registry/cleanup', { stale_threshold_minutes: 2 });
fetchData();
} catch (err: any) {
console.error('Cleanup error:', err);
}
};
// Remove a single worker // Remove a single worker
const handleRemoveWorker = async (workerId: string) => { const handleRemoveWorker = async (workerId: string) => {
if (!confirm('Remove this worker from the registry?')) return; if (!confirm('Remove this worker from the registry?')) return;
@@ -364,23 +354,13 @@ export function WorkersDashboard() {
{workers.length} registered workers ({busyWorkers.length} busy, {idleWorkers.length} idle) {workers.length} registered workers ({busyWorkers.length} busy, {idleWorkers.length} idle)
</p> </p>
</div> </div>
<div className="flex items-center gap-2"> <button
<button onClick={() => fetchData()}
onClick={handleCleanupStale} className="flex items-center gap-2 px-4 py-2 bg-emerald-600 text-white rounded-lg hover:bg-emerald-700 transition-colors"
className="flex items-center gap-2 px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors" >
title="Mark stale workers (no heartbeat > 2 min) as offline" <RefreshCw className="w-4 h-4" />
> Refresh
<Trash2 className="w-4 h-4" /> </button>
Cleanup Stale
</button>
<button
onClick={() => fetchData()}
className="flex items-center gap-2 px-4 py-2 bg-emerald-600 text-white rounded-lg hover:bg-emerald-700 transition-colors"
>
<RefreshCw className="w-4 h-4" />
Refresh
</button>
</div>
</div> </div>
{error && ( {error && (

View File

@@ -12,7 +12,7 @@ metadata:
name: scraper-worker name: scraper-worker
namespace: dispensary-scraper namespace: dispensary-scraper
spec: spec:
replicas: 5 replicas: 25
selector: selector:
matchLabels: matchLabels:
app: scraper-worker app: scraper-worker