ssb: Stop breaking up the news queries into chunks. It sometimes produced incorrect results, and it is not necessary if we're fast enough.

This commit is contained in:
Cory McWilliams 2025-01-25 20:13:05 -05:00
parent 83e00763ea
commit 71ff604f90
2 changed files with 60 additions and 67 deletions

View File

@ -1,5 +1,5 @@
{ {
"type": "tildefriends-app", "type": "tildefriends-app",
"emoji": "🦀", "emoji": "🦀",
"previous": "&wzVxQjLzBbwClkI3GB2t85i3pJxRcE1RnCXzC/TbfAw=.sha256" "previous": "&xT+7rr+XiiHu6hRK+cf15/CCECDyMIp+skvPByaa+eE=.sha256"
} }

View File

@ -106,11 +106,7 @@ class TfTabNewsFeedElement extends LitElement {
[this.hash.substring(1)] [this.hash.substring(1)]
); );
} else if (this.hash.startsWith('##')) { } else if (this.hash.startsWith('##')) {
let promises = []; result = await tfrpc.rpc.query(
const k_following_limit = 256;
for (let i = 0; i < this.following.length; i += k_following_limit) {
promises.push(
tfrpc.rpc.query(
` `
WITH WITH
all_news AS ( all_news AS (
@ -140,16 +136,13 @@ class TfTabNewsFeedElement extends LitElement {
SELECT TRUE AS is_primary, news.* FROM news SELECT TRUE AS is_primary, news.* FROM news
`, `,
[ [
JSON.stringify(this.following.slice(i, i + k_following_limit)), JSON.stringify(this.following),
start_time, start_time,
end_time, end_time,
this.hash.substring(2), this.hash.substring(2),
'"#' + this.hash.substring(2).replace('"', '""') + '"', '"#' + this.hash.substring(2).replace('"', '""') + '"',
] ]
)
); );
}
result = [].concat(...(await Promise.all(promises)));
} else if (this.hash == '#🔐') { } else if (this.hash == '#🔐') {
result = await tfrpc.rpc.query( result = await tfrpc.rpc.query(
` `