add queue

This commit is contained in:
soruh 2023-08-13 20:40:39 +02:00
parent 1d3b622b73
commit db76fbb27b

View File

@ -906,13 +906,13 @@ fn queue() {
let mut j = 0; let mut j = 0;
let mut i = 0; let mut i = 0;
for _ in 0..200 { for _ in 0..100 {
db.transaction(|transaction| { db.transaction(|transaction| {
let mut root = transaction.root(); let mut root = transaction.root();
let n = rng.gen_range(1..20); let n = rng.gen_range(1..20);
for _ in 0..n { for _ in 0..n {
if rng.gen_bool(0.5) || root.length(transaction) == 0 { if rng.gen_bool(0.6) || root.length(transaction) == 0 {
let how_many = rng.gen_range(1..20); let how_many = rng.gen_range(1..20);
let elements = (i..i + how_many).map(U64::from).collect::<Vec<U64>>(); let elements = (i..i + how_many).map(U64::from).collect::<Vec<U64>>();
root = root.enqueue_many(transaction, &elements); root = root.enqueue_many(transaction, &elements);
@ -928,11 +928,13 @@ fn queue() {
root root
}); });
if rng.gen_bool(0.5) { if rng.gen_bool(0.05) {
db.free_old_epochs(); db.free_old_epochs();
} }
} }
validate(&db);
db.transaction(|transaction| { db.transaction(|transaction| {
let mut root = transaction.root(); let mut root = transaction.root();