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