diff --git a/src/ssb.rpc.c b/src/ssb.rpc.c index 44c29e50..bc24db18 100644 --- a/src/ssb.rpc.c +++ b/src/ssb.rpc.c @@ -1279,7 +1279,8 @@ static void _tf_ssb_rpc_delete_blobs_work(uv_work_t* work) " SELECT blobs.id FROM blobs " " JOIN messages_refs ON blobs.id = messages_refs.ref " " JOIN messages ON messages.id = messages_refs.message " - " GROUP BY blobs.id HAVING MAX(messages.timestamp) < ? LIMIT ?)", -1, &statement, NULL) == SQLITE_OK) + " WHERE blobs.created < ?1 / 1000 " + " GROUP BY blobs.id HAVING MAX(messages.timestamp) < ?1 LIMIT ?2)", -1, &statement, NULL) == SQLITE_OK) { if (sqlite3_bind_int64(statement, 1, timestamp) == SQLITE_OK && sqlite3_bind_int(statement, 2, k_limit) == SQLITE_OK)