Rebuild: a lease never waits for prefetching; one-shot hashes
A lease was only granted for a range with spooled chunks, and the prefetcher kept ranges ahead per active lease: once the spool ran dry a worker got none and slept 30 s, fewer ranges were leased, fewer prefetched. Three workers held one lease between them (~50k headers/s). A lease now takes a spooled range first, else the next planned one (leased ranges are fetched first; the stream waits). crypto.hash instead of createHash().update().digest() for file and release keys: same digests, ~2.5x faster (~4.6% of a worker's time). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
168605148f
commit
9dc0a27bb4
5 files changed
+30
-25
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { createHash } from 'node:crypto'
|
||||
import { hash } from 'node:crypto'
|
||||
import type { Overview } from '../nntp/index.js'
|
||||
import { FileAggregator, type AggregatedFile, isArchiveStart, isLaterVolume, sevenZipVolume } from '../files/index.js'
|
||||
import { RuleSet, isRandomFile, uploadTool, type Rules } from '../rules/index.js'
|
||||
@@ -281,7 +281,7 @@ export class RangeIndexer {
|
||||
|
||||
/** The release key; a file without a recognisable release becomes a release of its own. */
|
||||
export function releaseKeyOf(s: EdgeSegment): string {
|
||||
return s.file.release?.key ?? createHash('sha1').update(`file\n${s.fileKey}`).digest('hex')
|
||||
return s.file.release?.key ?? hash('sha1', `file\n${s.fileKey}`)
|
||||
}
|
||||
|
||||
function postedOf(segments: EdgeSegment[]): number | null {
|
||||
|
||||
Reference in new issue
Block a user