From 89d3e9b4fecf7e696605924f2310e4adced81f57 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sat, 29 Nov 2025 15:37:17 -0500 Subject: [PATCH] ssb: Mentions have become too slow. Using refs instead of fts seems better and faster, again? --- apps/ssb.json | 2 +- apps/ssb/tf-tab-news-feed.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/ssb.json b/apps/ssb.json index 0b883c7a..e9a4af9b 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🦀", - "previous": "&QPdP4BaztX9l3BBQNVbFAu8t5iN5NTqzhIOr+8bNhb0=.sha256" + "previous": "&rjvfnAZ6XCB3JYO+Qtukpb5iYrbJ9niOLXCbbnQDmyY=.sha256" } diff --git a/apps/ssb/tf-tab-news-feed.js b/apps/ssb/tf-tab-news-feed.js index 85baa57f..5b341282 100644 --- a/apps/ssb/tf-tab-news-feed.js +++ b/apps/ssb/tf-tab-news-feed.js @@ -118,10 +118,11 @@ class TfTabNewsFeedElement extends LitElement { result = await tfrpc.rpc.query( ` WITH mentions AS (SELECT messages.rowid, messages.id, messages.previous, messages.author, messages.sequence, messages.timestamp, messages.hash, json(messages.content) AS content, messages.signature - FROM messages_fts(?1) - JOIN messages ON messages.rowid = messages_fts.rowid + FROM messages_refs + JOIN messages ON messages.id = messages_refs.message JOIN json_each(?2) AS following ON messages.author = following.value WHERE + messages_refs.ref = ?1 AND messages.author != ?1 AND (?3 IS NULL OR messages.timestamp >= ?3) AND messages.timestamp < ?4 ORDER BY timestamp DESC limit ?5) @@ -133,7 +134,7 @@ class TfTabNewsFeedElement extends LitElement { SELECT TRUE AS is_primary, * FROM mentions `, [ - '"' + this.whoami.replace('"', '""') + '"', + this.whoami, JSON.stringify(this.following), start_time, end_time,