Spots: unmatched ones matched again in turns; a standalone release gives way
A spot older than what the catalog has indexed (the spotter's first backfill reaches back ~3 months) matched nothing and would have become a release of its own, a duplicate once the history pass builds the upload. Unmatched spots are matched again in turns (rematched_at) for 30 days; the 24 h before a standalone release count from the inspection; a later match deletes the spot's own release and links the header pass's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7df5a638ca
commit
550f63cd84
4 files changed
+61
-6
No files matched your search
@@ -9,7 +9,8 @@ import { BaseSchema } from '@adonisjs/lucid/schema'
|
||||
* (alt.binaries.ftd), keeps its files in `spot_files`, and matches them to
|
||||
* the releases the header pass built (the same release identity), linking
|
||||
* them in `release_spots`. A spot whose files match no release becomes a
|
||||
* release of its own (source `spot`) once a day has passed.
|
||||
* release of its own (source `spot`) a day after its inspection (until
|
||||
* the header pass builds its releases after all: migration 2900).
|
||||
* The NZB itself is kept (gzip) for such a release's downloads.
|
||||
* Passwords are kept apart from the catalog in `release_passwords`, one row
|
||||
* per release and password, with where it came from (the NZB's meta, the
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { BaseSchema } from '@adonisjs/lucid/schema'
|
||||
|
||||
/**
|
||||
* Unmatched spots are matched again in turns (`rematched_at`), for 30 days after their inspection, also once they
|
||||
* became a release of their own: the header pass may build their releases later (a spot's history before the
|
||||
* catalog's), and then the spot moves to that release (LOG.md 2026-10-13 (45)).
|
||||
*/
|
||||
export default class extends BaseSchema {
|
||||
async up() {
|
||||
this.schema.raw(`ALTER TABLE spots ADD COLUMN IF NOT EXISTS rematched_at timestamptz`)
|
||||
// Inspected before the inspector set it (2026-10-13).
|
||||
this.schema.raw(`UPDATE spots SET matched = 0 WHERE status = 'inspected' AND matched IS NULL`)
|
||||
this.schema.raw(`DROP INDEX IF EXISTS spots_unmatched_idx`)
|
||||
this.schema.raw(`CREATE INDEX IF NOT EXISTS spots_unmatched_idx ON spots (coalesce(rematched_at, inspected_at)) WHERE status = 'inspected' AND matched = 0`)
|
||||
}
|
||||
|
||||
async down() {
|
||||
this.schema.raw(`DROP INDEX IF EXISTS spots_unmatched_idx`)
|
||||
this.schema.raw(`ALTER TABLE spots DROP COLUMN IF EXISTS rematched_at`)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user