Read-ahead per reader; compose passes READ_AHEAD and PERF_TRACE; report fixes
Each user gets an own read-ahead queue, served in turn, so two people reading at once no longer cancel each other's chapter. The report rounds phase times and measures the quiet time before a slow storage probe correctly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
896726a51b
commit
d7d3bf5b2b
6 files changed
+57
-34
No files matched your search
@@ -448,14 +448,14 @@ function continueOf(m, prog, s) {
|
||||
return next ? { c: next.id, text: 'Read next · ' + next.label } : { c: last.ch.id, v: last.p.v, text: 'Read again · ' + last.ch.label };
|
||||
}
|
||||
// From the saved page on, then the pages before it; afterwards the next chapter's preferred version.
|
||||
function warmChapter(m, ch, v, progress, s) {
|
||||
function warmChapter(u, m, ch, v, progress, s) {
|
||||
const from = Math.min(Math.max(0, +(progress && progress.v === v.id && progress.p) || 0), v.pages.length);
|
||||
const pages = v.pages.slice(from).concat(v.pages.slice(0, from)).map(p => path.join(LIB, v.rel, p.f));
|
||||
readAhead.warm(pages, `${m.id}/${ch.id}`);
|
||||
readAhead.warm(pages, `${m.id}/${ch.id}`, u.name);
|
||||
const next = neighbour(m, ch, 1, s), nextCh = next && m.chapterById.get(next.id);
|
||||
if (nextCh) {
|
||||
const nv = ranked(m, nextCh)[0].v;
|
||||
readAhead.then(nv.pages.map(p => path.join(LIB, nv.rel, p.f)), `${m.id}/${nextCh.id}`);
|
||||
readAhead.then(nv.pages.map(p => path.join(LIB, nv.rel, p.f)), `${m.id}/${nextCh.id}`, u.name);
|
||||
}
|
||||
}
|
||||
function neighbour(m, ch, step, s) {
|
||||
@@ -768,7 +768,7 @@ const routes = {
|
||||
let seen = false;
|
||||
for (const n of db.notes[u.name] || []) if (!n.read && n.m === m.id && n.c === ch.id) seen = n.read = true;
|
||||
if (seen) save();
|
||||
if (readAhead) warmChapter(m, ch, v, prog[ch.id], s);
|
||||
if (readAhead) warmChapter(u, m, ch, v, prog[ch.id], s);
|
||||
return {
|
||||
perf: tracer.on,
|
||||
manga: { id: m.id, title: m.title },
|
||||
|
||||
Reference in new issue
Block a user