move cork to remove_to_device_events fn
add cork around write-heavy database routine called in loop; cleanup Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
23cf2b2236
commit
b77a1eb079
3 changed files with 14 additions and 8 deletions
|
@ -5,7 +5,7 @@ use conduit::{
|
|||
utils::{stream::TryIgnore, string::Unquoted, ReadyExt},
|
||||
Err, Error, Result, Server,
|
||||
};
|
||||
use database::{Deserialized, Ignore, Interfix, Json, Map};
|
||||
use database::{Database, Deserialized, Ignore, Interfix, Json, Map};
|
||||
use futures::{FutureExt, Stream, StreamExt, TryFutureExt};
|
||||
use ruma::{
|
||||
api::client::{device::Device, error::ErrorKind, filter::FilterDefinition},
|
||||
|
@ -26,6 +26,7 @@ pub struct Service {
|
|||
|
||||
struct Services {
|
||||
server: Arc<Server>,
|
||||
db: Arc<Database>,
|
||||
account_data: Dep<account_data::Service>,
|
||||
admin: Dep<admin::Service>,
|
||||
globals: Dep<globals::Service>,
|
||||
|
@ -60,6 +61,7 @@ impl crate::Service for Service {
|
|||
Ok(Arc::new(Self {
|
||||
services: Services {
|
||||
server: args.server.clone(),
|
||||
db: args.db.clone(),
|
||||
account_data: args.depend::<account_data::Service>("account_data"),
|
||||
admin: args.depend::<admin::Service>("admin"),
|
||||
globals: args.depend::<globals::Service>("globals"),
|
||||
|
@ -721,6 +723,7 @@ impl Service {
|
|||
let mut last = prefix.clone();
|
||||
last.extend_from_slice(&until.to_be_bytes());
|
||||
|
||||
let _cork = self.services.db.cork_and_flush();
|
||||
self.db
|
||||
.todeviceid_events
|
||||
.rev_raw_keys_from(&last) // this includes last
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue