forked from cory/tildefriends
ssb: Clean up outdated dynamic blob_wants_cache entries.
This commit is contained in:
parent
0d7dfd8c9e
commit
8a0e190a86
@ -224,7 +224,9 @@ class TfElement extends LitElement {
|
|||||||
|
|
||||||
for (let id of ids_out_of_date) {
|
for (let id of ids_out_of_date) {
|
||||||
if (!cache.about[id]?.seq) {
|
if (!cache.about[id]?.seq) {
|
||||||
cache.about[id] = Object.assign(cache.about[id] ?? {}, {seq: users[id]?.seq ?? 0});
|
cache.about[id] = Object.assign(cache.about[id] ?? {}, {
|
||||||
|
seq: users[id]?.seq ?? 0,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1505,6 +1505,17 @@ static void _tf_ssb_rpc_delete_blobs_work(tf_ssb_t* ssb, void* user_data)
|
|||||||
int64_t timestamp = now - age * 1000ULL;
|
int64_t timestamp = now - age * 1000ULL;
|
||||||
const int k_limit = 128;
|
const int k_limit = 128;
|
||||||
int deleted = 0;
|
int deleted = 0;
|
||||||
|
if (sqlite3_prepare(db, "DELETE FROM blob_wants_cache WHERE source IS NULL and timestamp < ?1", -1, &statement, NULL) == SQLITE_OK)
|
||||||
|
{
|
||||||
|
if (sqlite3_bind_int64(statement, 1, timestamp) == SQLITE_OK)
|
||||||
|
{
|
||||||
|
if (sqlite3_step(statement) != SQLITE_DONE)
|
||||||
|
{
|
||||||
|
tf_printf("Deleting stale blob wants cache entries: %s.\n", sqlite3_errmsg(db));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sqlite3_finalize(statement);
|
||||||
|
}
|
||||||
if (sqlite3_prepare(db,
|
if (sqlite3_prepare(db,
|
||||||
"DELETE FROM blobs WHERE blobs.id IN ("
|
"DELETE FROM blobs WHERE blobs.id IN ("
|
||||||
" SELECT blobs.id FROM blobs "
|
" SELECT blobs.id FROM blobs "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user