streamline batch insertions

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-11-16 23:13:27 +00:00
parent a05dc03100
commit 90106c4c33
5 changed files with 63 additions and 49 deletions

View file

@ -73,11 +73,13 @@ pub fn index_pdu(&self, shortroomid: ShortRoomId, pdu_id: &RawPduId, message_bod
key.extend_from_slice(word.as_bytes());
key.push(0xFF);
key.extend_from_slice(pdu_id.as_ref()); // TODO: currently we save the room id a second time here
(key, Vec::<u8>::new())
key
})
.collect::<Vec<_>>();
self.db.tokenids.insert_batch(batch.iter());
self.db
.tokenids
.insert_batch(batch.iter().map(|k| (k.as_slice(), &[])));
}
#[implement(Service)]