feat(network): request-throttle controls to avoid YouTube rate-limiting
Re-implements the sleepRequests/sleepInterval/maxSleepInterval feature (--sleep-requests / --sleep-interval / --max-sleep-interval) from the stale feat/binary-management-and-library-scale branch, ported onto current main's structure (zod settingsSchema, decomposed NetworkCard). All default to 0/off, preserving current behaviour. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -106,6 +106,14 @@ describe('parseSettingsField (CC9 schema parity)', () => {
|
||||
expect(parseSettingsField('rateLimit', 'fast')).toEqual(fail)
|
||||
})
|
||||
|
||||
it('sleepRequests/sleepInterval/maxSleepInterval: coerce, round, clamp to [0,300]', () => {
|
||||
expect(parseSettingsField('sleepRequests', 5)).toEqual(ok(5))
|
||||
expect(parseSettingsField('sleepRequests', -3)).toEqual(ok(0))
|
||||
expect(parseSettingsField('sleepRequests', 999)).toEqual(ok(300))
|
||||
expect(parseSettingsField('sleepInterval', '4')).toEqual(ok(4))
|
||||
expect(parseSettingsField('maxSleepInterval', 7.6)).toEqual(ok(8))
|
||||
})
|
||||
|
||||
it('quality presets: allowlisted', () => {
|
||||
expect(parseSettingsField('defaultVideoQuality', '720p')).toEqual(ok('720p'))
|
||||
expect(parseSettingsField('defaultVideoQuality', '4K')).toEqual(fail)
|
||||
|
||||
Reference in New Issue
Block a user