···1919use tokio::time::sleep;
2020use tokio::sync::{mpsc::Receiver, Mutex};
21212222-/// Commit the RW batch immediately if this nubmer of events have been read off the mod queue
2323-const MAX_BATCHED_RW_EVENTS: usize = 3;
2222+/// Commit the RW batch immediately if this number of events have been read off the mod queue
2323+const MAX_BATCHED_RW_EVENTS: usize = 16;
24242525/// Commit the RW batch immediately if this number of records is reached
2626///
···2929/// - doing more work whenever scheduled means getting more CPU time in general
3030///
3131/// this is higher than [MAX_BATCHED_RW_EVENTS] because account-deletes can have lots of items
3232-const MAX_BATCHED_RW_ITEMS: usize = 36;
3232+const MAX_BATCHED_RW_ITEMS: usize = 48;
333334343535+#[derive(Clone)]
3536struct SerialDb {
3637 keyspace: Keyspace,
3738 partition: PartitionHandle,
3839}
4040+4141+// struct FakeMutex<T> {
4242+// thing: T,
4343+// }
4444+// impl<T: Clone> FakeMutex<T> {
4545+// pub fn new(thing: T) -> Self {
4646+// Self { thing }
4747+// }
4848+// pub async fn lock(&self) -> T {
4949+// self.thing.clone()
5050+// }
5151+// }
39524053/**
4154 * data format, roughly:
···155168 pub async fn rw_loop(&self) -> anyhow::Result<()> {
156169 // TODO: lock so that only one rw loop can possibly be run. or even better, take a mutable resource thing to enforce at compile time.
157170 loop {
158158- sleep(Duration::from_secs_f64(0.001)).await; // todo: interval rate-limit instead
171171+ sleep(Duration::from_secs_f64(0.15)).await; // todo: interval rate-limit instead
159172160173 let db = self.db.lock().await;
161174 let keyspace = db.keyspace.clone();