ssb: More different feed culling logic.
This commit is contained in:
parent
f72395756a
commit
6f96d4ce65
@ -1594,27 +1594,21 @@ static void _tf_ssb_rpc_delete_feeds_work(tf_ssb_t* ssb, void* user_data)
|
||||
db = tf_ssb_acquire_db_writer(ssb);
|
||||
sqlite3_stmt* statement;
|
||||
if (sqlite3_prepare(db,
|
||||
"DELETE FROM messages WHERE author IN ("
|
||||
" SELECT author FROM messages WHERE author NOT IN (SELECT value FROM json_each(?)) GROUP BY author LIMIT 1"
|
||||
") RETURNING author",
|
||||
"DELETE FROM messages WHERE id IN ("
|
||||
" SELECT id FROM messages WHERE author NOT IN (SELECT value FROM json_each(?)) ORDER BY rowid DESC LIMIT 1024"
|
||||
")",
|
||||
-1, &statement, NULL) == SQLITE_OK)
|
||||
{
|
||||
int status = SQLITE_OK;
|
||||
bool printed = false;
|
||||
if (sqlite3_bind_text(statement, 1, arg, -1, NULL) == SQLITE_OK)
|
||||
{
|
||||
while ((status = sqlite3_step(statement)) == SQLITE_ROW)
|
||||
if (status != SQLITE_OK)
|
||||
{
|
||||
if (!printed)
|
||||
{
|
||||
tf_printf("deleting %s\n", sqlite3_column_text(statement, 0));
|
||||
printed = true;
|
||||
delete->deleted++;
|
||||
}
|
||||
tf_printf("deleting messages: %s\n", sqlite3_errmsg(db));
|
||||
}
|
||||
if (status != SQLITE_DONE)
|
||||
else
|
||||
{
|
||||
tf_printf("deleting feeds: %s\n", sqlite3_errmsg(db));
|
||||
delete->deleted += sqlite3_changes(db);
|
||||
}
|
||||
}
|
||||
sqlite3_finalize(statement);
|
||||
@ -1627,7 +1621,7 @@ static void _tf_ssb_rpc_delete_feeds_work(tf_ssb_t* ssb, void* user_data)
|
||||
JS_FreeRuntime(runtime);
|
||||
|
||||
delete->duration_ms = (uv_hrtime() - start_ns) / 1000000LL;
|
||||
tf_printf("Deleted %d feeds in %d ms.\n", delete->deleted, (int)delete->duration_ms);
|
||||
tf_printf("Deleted %d message in %d ms.\n", delete->deleted, (int)delete->duration_ms);
|
||||
_tf_ssb_rpc_checkpoint(ssb);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user