On homelab (1 Gbit, 20 connections, ~630k articles/s) the coordinator used 1.3-1.7 cores, mostly GC of the text it inflated only to know a compressed reply was complete, plus a copy of every reply. A raw reply is now complete when it ends in ".\r\n" (no copy): 0.4-0.5 cores at the same rate. ".\r\n" can also end a network read inside the compressed data (~1 in 16M reads, a few dozen times over the whole target). Such a chunk doesn't inflate on the worker: it reports it (POST ranges/:id/corrupt), the spooled chunk is removed and the range goes back to the queue; the prefetcher fetches it again. The rest of that reply breaks the connection's next command, so the connection is replaced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
61 lines
1.8 KiB
TypeScript
61 lines
1.8 KiB
TypeScript
/*
|
||
|--------------------------------------------------------------------------
|
||
| Routes file
|
||
|--------------------------------------------------------------------------
|
||
|
|
||
| The routes file is used for defining the HTTP routes.
|
||
|
|
||
*/
|
||
|
||
import { middleware } from '#start/kernel'
|
||
import router from '@adonisjs/core/services/router'
|
||
import { controllers } from '#generated/controllers'
|
||
|
||
router.get('/', () => {
|
||
return { hello: 'world' }
|
||
})
|
||
|
||
router
|
||
.group(() => {
|
||
router
|
||
.group(() => {
|
||
router.post('signup', [controllers.NewAccount, 'store'])
|
||
router.post('login', [controllers.AccessTokens, 'store'])
|
||
})
|
||
.prefix('auth')
|
||
.as('auth')
|
||
|
||
router
|
||
.group(() => {
|
||
router.get('profile', [controllers.Profile, 'show'])
|
||
router.post('logout', [controllers.AccessTokens, 'destroy'])
|
||
})
|
||
.prefix('account')
|
||
.as('profile')
|
||
.use(middleware.auth())
|
||
|
||
// The catalog (REBUILD.md, part 9).
|
||
router
|
||
.group(() => {
|
||
router.get('releases', [controllers.Releases, 'index'])
|
||
router.get('releases/:id/nzb', [controllers.Releases, 'nzb'])
|
||
})
|
||
.use(middleware.auth({ guards: ['api'] }))
|
||
|
||
// Edge workers (REBUILD.md, parts 1–2).
|
||
router
|
||
.group(() => {
|
||
router.post('lease', [controllers.Node, 'lease'])
|
||
router.get('ranges/:id/stream', [controllers.Node, 'stream'])
|
||
router.post('ranges/:id/batches', [controllers.Node, 'batch'])
|
||
router.post('ranges/:id/heartbeat', [controllers.Node, 'heartbeat'])
|
||
router.post('ranges/:id/finish', [controllers.Node, 'finish'])
|
||
router.post('ranges/:id/release', [controllers.Node, 'release'])
|
||
router.post('ranges/:id/corrupt', [controllers.Node, 'corrupt'])
|
||
})
|
||
.prefix('node')
|
||
.as('node')
|
||
.use(middleware.auth({ guards: ['node'] }))
|
||
})
|
||
.prefix('/api/v1')
|