Handle large WeebCentral catalogs and correct MangaPill checkpoint monitoring
This commit is contained in:
1 parent
0d51f214d5
commit
edbc9c6056
11 files changed
+102
-7
No files matched your search
+7
-1
@@ -515,7 +515,11 @@ class ScraperService {
|
||||
async jobState(item) {
|
||||
if (!item) return null;
|
||||
if (item.kind === 'inspection') return { status: 'discovering', updated: item.started, completed: 0, total: null, current: null };
|
||||
const file = path.join(this.libraryRoot, `.mcscraper-work-${item.seriesId || item.id}`, 'job.json');
|
||||
const sourceId = item.seriesId || item.id;
|
||||
const workName = item.source === 'mangapill'
|
||||
? `.mcscraper-work-mangapill-${sourceId}`
|
||||
: `.mcscraper-work-${sourceId}`;
|
||||
const file = path.join(this.libraryRoot, workName, 'job.json');
|
||||
try {
|
||||
const job = JSON.parse(await fs.readFile(file, 'utf8'));
|
||||
return {
|
||||
@@ -716,6 +720,7 @@ class ScraperService {
|
||||
}
|
||||
item.status = 'queued'; delete item.error; delete item.failure; delete item.nextAttemptAt;
|
||||
item.recoveryAttempts = 0;
|
||||
item.stallRecoveries = 0;
|
||||
delete this.state.sourcePaused[source]; delete this.state.circuits[source];
|
||||
for (const incident of this.state.incidents) if (incident.jobId === item.id && incident.state === 'open') { incident.state = 'resolved'; incident.resolution = 'operator-retry'; }
|
||||
this.state.lastError = null; this.state.paused = false; this.recomputeStatus();
|
||||
@@ -739,6 +744,7 @@ class ScraperService {
|
||||
// Compare observations so a stale watcher cannot disturb a progressing worker.
|
||||
if (Object.values(this.state.currentIds).includes(item.id)) {
|
||||
const job = await this.jobState(item);
|
||||
if (!job) return { changed: false };
|
||||
if (progressKey(job) !== input.progressKey || this.state.paused || item.stopReason) return { changed: false };
|
||||
if (Date.now() - Date.parse(job?.updated || item.started) < 900000) return { changed: false };
|
||||
if ((item.stallRecoveries || 0) >= 1) {
|
||||
|
||||
Reference in new issue
Block a user