Pausing a watch stops the batch it's in the middle of

Pause only prevented the next check: the batch already running kept importing
its remaining models, which is the opposite of what the button suggests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
dlawler489 2026-09-16 12:50:56 +10:00
parent cd95890296
commit 239654be13

View file

@ -157,6 +157,9 @@ async function importFound(watch, collection) {
let problem = null; let problem = null;
const fresh = []; const fresh = [];
for (const design of todo) { for (const design of todo) {
// Paused while this batch was running: stop, rather than import the rest.
const { rows: [live] } = await db.query('SELECT enabled FROM watched_collections WHERE id = $1', [watch.id]);
if (!live || !live.enabled) break;
const url = makerworld.designUrl(design); const url = makerworld.designUrl(design);
try { try {
const result = await deps.importFromUrl(url, { projects: watch.project_id ? [watch.project_id] : [] }); const result = await deps.importFromUrl(url, { projects: watch.project_id ? [watch.project_id] : [] });