#241: on production, All Subscriptions' query runs in 31 ms, unread oldest-first in 30, the feed list's count in 5, generic plans included (EXPLAIN ANALYZE, BUFFERS, read only), against 0.3-1.6 s in ipx. A new Postgres connection takes 80-330 ms to open, and a page load asks for more than are idle: four of six slow loads came as the pool grew (3 to 6, 2 to 6, 3 to 5, 6 to 8), and 20 requests at once took a median 414 ms while the pool grew from 8 to 20. The daemon and the directory's server now keep their whole pool open (min = max); a command such as `ipx status`, and the tests, which share the server's 100 connections, open as they need. #246: the page reports list_shown, the ms from asking for a list to drawing it, with the view and filter, under the click's trace; background refreshes are not timed. Timings skip report()'s once-a-minute limit, which is for errors in a loop. A dashboard panel and table, and the prod check, read it. #245: the load test's browse scenario subscribes by OPML and leaves the Directory, which is ipx-directory's since #204, to it. CLAUDE.md records the owner's leave to EXPLAIN (ANALYZE, BUFFERS) any query on production, read only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@ let sse: EventSource;
|
||||
/// the app is in the background, when everything is missed (#168).
|
||||
const catchUp=(()=>{ let t: number; return ()=>{ clearTimeout(t); t=setTimeout(()=>{
|
||||
loadFeeds(true).catch(()=>{});
|
||||
if(S.feed) loadEntries().catch(()=>{});
|
||||
if(S.feed) loadEntries(false,true).catch(()=>{});
|
||||
},300); }; })();
|
||||
document.addEventListener('visibilitychange',()=>{ if(!document.hidden) catchUp(); });
|
||||
let dropped=false;
|
||||
@@ -16,7 +16,7 @@ function connect(){
|
||||
sse.onopen=()=>{ if(dropped){ dropped=false; catchUp(); } };
|
||||
const soon=(fn: ()=>void,ms=500)=>{ let t: number; return ()=>{ clearTimeout(t); t=setTimeout(fn,ms); }; };
|
||||
// Caught: a network gone when one fires (a laptop asleep) was an unhandled rejection (#219).
|
||||
const refreshEntries=soon(()=>{ if(S.feed) loadEntries().catch(()=>{}); });
|
||||
const refreshEntries=soon(()=>{ if(S.feed) loadEntries(false,true).catch(()=>{}); });
|
||||
// Every scan's events reach everyone; only this person's feeds are theirs to show or refresh.
|
||||
const mine=(id: string)=>S.feeds.some(f=>f.id===id);
|
||||
sse.onmessage=m=>{
|
||||
@@ -41,7 +41,7 @@ function connect(){
|
||||
if(!mine(ev.feed)) return;
|
||||
if(ev.saved_s>0&&document.querySelector('.dapend')) toast(`DeadAir is done: ${shorter(ev.saved_s)}`);
|
||||
refreshEntries();
|
||||
if(S.sel) loadEntries().then(()=>{ const e=cur(); if(e) showDetail(e); }).catch(()=>{});
|
||||
if(S.sel) loadEntries(false,true).then(()=>{ const e=cur(); if(e) showDetail(e); }).catch(()=>{});
|
||||
}
|
||||
else if(ev.ev==='download_error'){
|
||||
const bar=document.querySelector(`.dlbar[data-bar="${ev.enclosure}"]`);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* ---------------- items ---------------- */
|
||||
let loadSeq=0;
|
||||
async function loadEntries(append?: boolean){
|
||||
/// `quiet` for a refresh nobody asked for (a live update): not a wait anyone sees, so not timed.
|
||||
async function loadEntries(append?: boolean, quiet?: boolean){
|
||||
// The Directory lists feeds, and Currently Listening draws its own episodes.
|
||||
if(!S.feed || VIEWS[S.feed]?.url) return;
|
||||
const p=new URLSearchParams({offset:String(S.offset),limit:String(LIMIT),filter:S.filter,sort:S.sort.col,dir:S.sort.dir});
|
||||
@@ -29,6 +30,9 @@ async function loadEntries(append?: boolean){
|
||||
}
|
||||
S.entries = entries;
|
||||
renderEntries();
|
||||
// From asking to the list drawn: what someone waits for after a click, under that click's trace
|
||||
// (#246). The API's own time is in the trace; this is the whole wait, the network included.
|
||||
if(!quiet) report('list_shown',{ms:Math.round(performance.now()-asked),feed:S.feed,filter:S.filter});
|
||||
}
|
||||
function renderEntries(){
|
||||
const box=$('#eps'); if(!box) return;
|
||||
|
||||
@@ -93,8 +93,9 @@ function traceparent(){
|
||||
/// a frame.
|
||||
const reported=new Map<string,number>();
|
||||
function report(ev: string, o: Record<string,any>={}){
|
||||
// A timing comes of something someone did, not a loop, so every one is sent.
|
||||
const key=ev+(o.msg||''), now=Date.now();
|
||||
if(o.msg==='signed out' || now-(reported.get(key)||0)<60_000) return;
|
||||
if(o.msg==='signed out' || (o.ms==null && now-(reported.get(key)||0)<60_000)) return;
|
||||
reported.set(key,now);
|
||||
fetch('/api/client',{method:'POST',keepalive:true,headers:{'Content-Type':'application/json',traceparent:traceparent()},
|
||||
body:JSON.stringify({ev,...o})}).catch(()=>{});
|
||||
|
||||
Reference in New Issue
Block a user