Release completeness: note only releases where it can change; names from files
A sweep checked 430k noted releases in 51 minutes, nearly all without a par2 listing or file total, where completeness can't change. Listed names are now matched against the files themselves rather than through binaries, which seeding mostly no longer creates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
06de0f21c5
commit
e7e338213a
2 files changed
+120
-1
No files matched your search
@@ -45,9 +45,34 @@ test.group('release completeness', (group) => {
|
||||
const row = await db.from('releases').where('id', id).first()
|
||||
assert.equal(Number(row.file_count), 3)
|
||||
assert.deepEqual(row.extensions, ['bin'])
|
||||
// Noted for the completeness sweep once, not per file.
|
||||
// No par2 listing, no file total, not complete: its completeness can't change, so it isn't noted.
|
||||
const [{ count }] = await db.from('release_dirty').where('release_id', id).count('* as count')
|
||||
assert.equal(Number(count), 0)
|
||||
})
|
||||
|
||||
test('a release with a par2 listing is noted once per insert, and complete by file names alone', async ({ assert }) => {
|
||||
const now = new Date()
|
||||
const [row] = await db
|
||||
.table('releases')
|
||||
.insert({ release_key: 'names-only'.padEnd(40, '0'), name: 'Names.Only', source: 'stem', groups: '[]', first_seen_at: now, last_seen_at: now })
|
||||
.returning('id')
|
||||
const id = Number(row.id)
|
||||
await db.rawQuery(
|
||||
`INSERT INTO release_files (release_id, par2_file_id, name, size, md5_16k, set_id)
|
||||
SELECT ?::bigint, md5(i::text), 'n' || i || '.rar', 100000 + i, md5(i::text), 'set' FROM generate_series(1, 3) i`,
|
||||
[id]
|
||||
)
|
||||
await ReleaseCompleteness.sweep()
|
||||
// Seeded files: no binaries, matched by name only.
|
||||
await db.rawQuery(
|
||||
`INSERT INTO files (filename, poster, date, parts, groups, segments, release_id, file_key, created_at, updated_at)
|
||||
SELECT 'n' || i || '.rar', 'x', 0, 1, '[]', '\\x'::bytea, ?::bigint, 'names-only-' || i, now(), now() FROM generate_series(1, 3) i`,
|
||||
[id]
|
||||
)
|
||||
const [{ count }] = await db.from('release_dirty').where('release_id', id).count('* as count')
|
||||
assert.equal(Number(count), 1)
|
||||
await ReleaseCompleteness.sweep()
|
||||
assert.isTrue(Boolean((await db.from('releases').where('id', id).first()).complete))
|
||||
})
|
||||
|
||||
test('complete when every listed file of 64 KiB or more is there, by size or name', async ({ assert }) => {
|
||||
|
||||
Reference in new issue
Block a user