Delete more aggressively.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4370 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
afde69b5d9
commit
d21d7e4add
@ -1152,12 +1152,13 @@ static void _tf_ssb_rpc_delete_blobs_work(uv_work_t* work)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int64_t start_ns = uv_hrtime();
|
||||
sqlite3* db = tf_ssb_acquire_db_writer(ssb);
|
||||
sqlite3_stmt* statement;
|
||||
int64_t now = (int64_t)time(NULL) * 1000ULL;
|
||||
int64_t timestamp = now - age * 1000ULL;
|
||||
const int k_limit = 256;
|
||||
bool deleted = false;
|
||||
int deleted = 0;
|
||||
if (sqlite3_prepare(db,
|
||||
"DELETE FROM blobs WHERE blobs.id IN ("
|
||||
" SELECT blobs.id FROM blobs "
|
||||
@ -1177,7 +1178,7 @@ static void _tf_ssb_rpc_delete_blobs_work(uv_work_t* work)
|
||||
{
|
||||
tf_printf("_tf_ssb_rpc_delete_blobs_work: %d rows\n", sqlite3_changes(db));
|
||||
}
|
||||
deleted = sqlite3_changes(db) != 0;
|
||||
deleted = sqlite3_changes(db);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1185,10 +1186,11 @@ static void _tf_ssb_rpc_delete_blobs_work(uv_work_t* work)
|
||||
tf_printf("prepare failed: %s\n", sqlite3_errmsg(db));
|
||||
}
|
||||
tf_ssb_release_db_writer(ssb, db);
|
||||
|
||||
int64_t duration_ms = (uv_hrtime() - start_ns) / 1000000LL;
|
||||
tf_printf("Deleted %d blobs in %d ms.\n", deleted, (int)duration_ms);
|
||||
if (deleted)
|
||||
{
|
||||
_tf_ssb_rpc_start_delete_blobs(ssb, 60 * 1000);
|
||||
_tf_ssb_rpc_start_delete_blobs(ssb, (int)duration_ms);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user