ssb: Just request blobs for all references from about messages for now. Much faster than narrowing down to the most recent images.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 17m21s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 17m21s
This commit is contained in:
parent
6d6927213f
commit
53044696ba
20
src/ssb.db.c
20
src/ssb.db.c
@ -233,13 +233,21 @@ void tf_ssb_db_init(tf_ssb_t* ssb)
|
|||||||
_tf_ssb_db_exec(db, "DROP VIEW IF EXISTS blob_wants_view");
|
_tf_ssb_db_exec(db, "DROP VIEW IF EXISTS blob_wants_view");
|
||||||
_tf_ssb_db_exec(db,
|
_tf_ssb_db_exec(db,
|
||||||
"CREATE VIEW IF NOT EXISTS blob_wants_view (id, timestamp) AS "
|
"CREATE VIEW IF NOT EXISTS blob_wants_view (id, timestamp) AS "
|
||||||
" SELECT messages_refs.ref AS id, messages.timestamp AS timestamp "
|
" WITH wanted AS ( "
|
||||||
" FROM messages_refs "
|
" SELECT messages_refs.ref AS id, messages.timestamp AS timestamp "
|
||||||
" JOIN messages ON messages.id = messages_refs.message "
|
" FROM messages_refs "
|
||||||
" LEFT OUTER JOIN blobs ON messages_refs.ref = blobs.id "
|
" JOIN messages ON messages.id = messages_refs.message "
|
||||||
|
" UNION "
|
||||||
|
" SELECT messages_refs.ref AS id, unixepoch() * 1000 AS timestamp "
|
||||||
|
" FROM messages_refs "
|
||||||
|
" JOIN messages ON messages.id = messages_refs.message "
|
||||||
|
" WHERE messages.content ->> 'type' = 'about' "
|
||||||
|
" ) "
|
||||||
|
" SELECT wanted.id, wanted.timestamp FROM wanted "
|
||||||
|
" LEFT OUTER JOIN blobs ON wanted.id = blobs.id "
|
||||||
" WHERE blobs.id IS NULL "
|
" WHERE blobs.id IS NULL "
|
||||||
" AND LENGTH(messages_refs.ref) = 52 "
|
" AND LENGTH(wanted.id) = 52 "
|
||||||
" AND messages_refs.ref LIKE '&%.sha256'");
|
" AND wanted.id LIKE '&%.sha256'");
|
||||||
|
|
||||||
bool need_add_flags = true;
|
bool need_add_flags = true;
|
||||||
bool need_convert_timestamp_to_real = false;
|
bool need_convert_timestamp_to_real = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user