The sidecar fold first in a merger round: a queue, it needn't wait for the par2 pass
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e627862a8d
commit
2e25b7c56e
1 file changed
+4
-3
@@ -105,13 +105,16 @@ export class Par2Merger {
|
|||||||
this.since = saved ? new Date(saved.at) : new Date(0)
|
this.since = saved ? new Date(saved.at) : new Date(0)
|
||||||
}
|
}
|
||||||
const since = new Date(this.since.getTime() - OVERLAP_MS)
|
const since = new Date(this.since.getTime() - OVERLAP_MS)
|
||||||
|
// First: sidecars (.nfo, .sfv, .nzb) apart from their upload join it. A queue, not since: it needn't wait for the
|
||||||
|
// par2 pass (hours when that starts over).
|
||||||
|
const folded = await this.folder.round()
|
||||||
const { rows } = await db.rawQuery(
|
const { rows } = await db.rawQuery(
|
||||||
`SELECT set_id FROM par2_sets WHERE created_at >= ?
|
`SELECT set_id FROM par2_sets WHERE created_at >= ?
|
||||||
UNION
|
UNION
|
||||||
SELECT f.set_id FROM file_hashes h JOIN par2_files f ON f.hash16k = h.hash16k AND f.length = h.size WHERE h.created_at >= ?`,
|
SELECT f.set_id FROM file_hashes h JOIN par2_files f ON f.hash16k = h.hash16k AND f.length = h.size WHERE h.created_at >= ?`,
|
||||||
[since, since]
|
[since, since]
|
||||||
)
|
)
|
||||||
const round: MergeRound = { sets: rows.length, merges: 0, releases: 0, stems: 0, stemMerges: 0, stemReleases: 0 }
|
const round: MergeRound = { sets: rows.length, merges: 0, releases: 0, stems: 0, stemMerges: 0, stemReleases: 0, folded }
|
||||||
for (const { set_id: setId } of rows) {
|
for (const { set_id: setId } of rows) {
|
||||||
if (this.stopped) return round
|
if (this.stopped) return round
|
||||||
// One set that fails doesn't hold up the others (nor the next round, which would start from the same point).
|
// One set that fails doesn't hold up the others (nor the next round, which would start from the same point).
|
||||||
@@ -141,8 +144,6 @@ export class Par2Merger {
|
|||||||
round.stemReleases += merged + 1
|
round.stemReleases += merged + 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Third: sidecars (.nfo, .sfv, .nzb) apart from their upload join it.
|
|
||||||
if (!this.stopped) round.folded = await this.folder.round()
|
|
||||||
// Only after a whole round: a restart halfway goes on from the round before.
|
// Only after a whole round: a restart halfway goes on from the round before.
|
||||||
this.since = now[0].at
|
this.since = now[0].at
|
||||||
await db.rawQuery(
|
await db.rawQuery(
|
||||||
|
|||||||
Reference in new issue
Block a user