ssb: Gather all the votes for messages seen.
This commit is contained in:
parent
bc7c658293
commit
ba2bb17638
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"type": "tildefriends-app",
|
"type": "tildefriends-app",
|
||||||
"emoji": "🦀",
|
"emoji": "🦀",
|
||||||
"previous": "&VvfYCIWHlYDtlgOBhDByg1l9rt8NIRt/TCurKx2/AWE=.sha256"
|
"previous": "&shP+cVoCoktYoePzAG2wj1vCx/eGXZPnoP1MDHT3d6g=.sha256"
|
||||||
}
|
}
|
||||||
|
@ -202,6 +202,28 @@ class TfTabNewsFeedElement extends LitElement {
|
|||||||
[JSON.stringify(this.following), JSON.stringify(refs.map((x) => x.ref))]
|
[JSON.stringify(this.following), JSON.stringify(refs.map((x) => x.ref))]
|
||||||
);
|
);
|
||||||
result = [].concat(result, related_messages);
|
result = [].concat(result, related_messages);
|
||||||
|
refs = await tfrpc.rpc.query(
|
||||||
|
`
|
||||||
|
WITH
|
||||||
|
news AS (
|
||||||
|
SELECT value AS id FROM json_each(?)
|
||||||
|
)
|
||||||
|
SELECT refs_out.ref AS ref FROM messages_refs refs_out JOIN news ON refs_out.message = news.id
|
||||||
|
UNION
|
||||||
|
SELECT refs_in.message AS ref FROM messages_refs refs_in JOIN news ON refs_in.ref = news.id
|
||||||
|
`,
|
||||||
|
[JSON.stringify(result.map((x) => x.id))]
|
||||||
|
);
|
||||||
|
result = [].concat(result, await tfrpc.rpc.query(
|
||||||
|
`
|
||||||
|
SELECT FALSE AS is_primary, messages.rowid, messages.id, messages.previous, messages.author, messages.sequence, messages.timestamp, messages.hash, json(messages.content) AS content, messages.signature
|
||||||
|
FROM messages
|
||||||
|
JOIN json_each(?2) refs ON messages.id = refs.value
|
||||||
|
JOIN json_each(?1) AS following ON messages.author = following.value
|
||||||
|
WHERE messages.content ->> 'type' = 'vote'
|
||||||
|
`,
|
||||||
|
[JSON.stringify(this.following), JSON.stringify(refs.map((x) => x.ref))]
|
||||||
|
));
|
||||||
let t3 = new Date();
|
let t3 = new Date();
|
||||||
console.log(
|
console.log(
|
||||||
`load of ${result.length} rows took ${(t3 - t0) / 1000} (${(t1 - t0) / 1000} to find ${news_length} messages, ${(t2 - t1) / 1000} to find ${refs.length} refs, and ${(t3 - t2) / 1000} to find ${related_messages.length} related messages) following=${this.following.length} st=${start_time} et=${end_time}`
|
`load of ${result.length} rows took ${(t3 - t0) / 1000} (${(t1 - t0) / 1000} to find ${news_length} messages, ${(t2 - t1) / 1000} to find ${refs.length} refs, and ${(t3 - t2) / 1000} to find ${related_messages.length} related messages) following=${this.following.length} st=${start_time} et=${end_time}`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user