Fix items-after-statements
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
2ab427fe99
commit
68cbf19154
6 changed files with 14 additions and 13 deletions
|
@ -494,6 +494,8 @@ async fn handle_left_room(
|
||||||
async fn process_presence_updates(
|
async fn process_presence_updates(
|
||||||
presence_updates: &mut HashMap<OwnedUserId, PresenceEvent>, since: u64, syncing_user: &OwnedUserId,
|
presence_updates: &mut HashMap<OwnedUserId, PresenceEvent>, since: u64, syncing_user: &OwnedUserId,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
use crate::service::presence::Presence;
|
||||||
|
|
||||||
// Take presence updates
|
// Take presence updates
|
||||||
for (user_id, _, presence_bytes) in services().presence.presence_since(since) {
|
for (user_id, _, presence_bytes) in services().presence.presence_since(since) {
|
||||||
if !services()
|
if !services()
|
||||||
|
@ -504,7 +506,6 @@ async fn process_presence_updates(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
use crate::service::presence::Presence;
|
|
||||||
let presence_event = Presence::from_json_bytes_to_event(&presence_bytes, &user_id)?;
|
let presence_event = Presence::from_json_bytes_to_event(&presence_bytes, &user_id)?;
|
||||||
match presence_updates.entry(user_id) {
|
match presence_updates.entry(user_id) {
|
||||||
Entry::Vacant(slot) => {
|
Entry::Vacant(slot) => {
|
||||||
|
|
|
@ -23,13 +23,13 @@ impl KvTree for RocksDbEngineTree<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn multi_get(&self, keys: &[&[u8]]) -> Result<Vec<Option<Vec<u8>>>> {
|
fn multi_get(&self, keys: &[&[u8]]) -> Result<Vec<Option<Vec<u8>>>> {
|
||||||
let mut readoptions = rust_rocksdb::ReadOptions::default();
|
|
||||||
readoptions.set_total_order_seek(true);
|
|
||||||
|
|
||||||
// Optimization can be `true` if key vector is pre-sorted **by the column
|
// Optimization can be `true` if key vector is pre-sorted **by the column
|
||||||
// comparator**.
|
// comparator**.
|
||||||
const SORTED: bool = false;
|
const SORTED: bool = false;
|
||||||
|
|
||||||
|
let mut readoptions = rust_rocksdb::ReadOptions::default();
|
||||||
|
readoptions.set_total_order_seek(true);
|
||||||
|
|
||||||
let mut ret: Vec<Option<Vec<u8>>> = Vec::with_capacity(keys.len());
|
let mut ret: Vec<Option<Vec<u8>>> = Vec::with_capacity(keys.len());
|
||||||
for res in self
|
for res in self
|
||||||
.db
|
.db
|
||||||
|
|
|
@ -261,8 +261,9 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
|
||||||
|
|
||||||
impl Drop for Engine {
|
impl Drop for Engine {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
debug!("Waiting for background tasks to finish...");
|
|
||||||
const BLOCKING: bool = true;
|
const BLOCKING: bool = true;
|
||||||
|
|
||||||
|
debug!("Waiting for background tasks to finish...");
|
||||||
self.rocks.cancel_all_background_work(BLOCKING);
|
self.rocks.cancel_all_background_work(BLOCKING);
|
||||||
|
|
||||||
debug!("Shutting down background threads");
|
debug!("Shutting down background threads");
|
||||||
|
|
|
@ -17,13 +17,14 @@ use super::{
|
||||||
/// columns, therefor columns should only be opened after passing this result
|
/// columns, therefor columns should only be opened after passing this result
|
||||||
/// through cf_options().
|
/// through cf_options().
|
||||||
pub(crate) fn db_options(config: &Config, env: &mut Env, row_cache: &Cache, col_cache: &Cache) -> Options {
|
pub(crate) fn db_options(config: &Config, env: &mut Env, row_cache: &Cache, col_cache: &Cache) -> Options {
|
||||||
|
const MIN_PARALLELISM: usize = 2;
|
||||||
|
|
||||||
let mut opts = Options::default();
|
let mut opts = Options::default();
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
set_logging_defaults(&mut opts, config);
|
set_logging_defaults(&mut opts, config);
|
||||||
|
|
||||||
// Processing
|
// Processing
|
||||||
const MIN_PARALLELISM: usize = 2;
|
|
||||||
let threads = if config.rocksdb_parallelism_threads == 0 {
|
let threads = if config.rocksdb_parallelism_threads == 0 {
|
||||||
cmp::max(MIN_PARALLELISM, utils::available_parallelism())
|
cmp::max(MIN_PARALLELISM, utils::available_parallelism())
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -49,12 +49,11 @@ impl Service {
|
||||||
where
|
where
|
||||||
T: OutgoingRequest + Debug,
|
T: OutgoingRequest + Debug,
|
||||||
{
|
{
|
||||||
let dest = dest.replace(services().globals.notification_push_path(), "");
|
|
||||||
|
|
||||||
trace!("Push gateway destination: {dest}");
|
|
||||||
|
|
||||||
const VERSIONS: [MatrixVersion; 1] = [MatrixVersion::V1_0];
|
const VERSIONS: [MatrixVersion; 1] = [MatrixVersion::V1_0];
|
||||||
|
|
||||||
|
let dest = dest.replace(services().globals.notification_push_path(), "");
|
||||||
|
trace!("Push gateway destination: {dest}");
|
||||||
|
|
||||||
let http_request = request
|
let http_request = request
|
||||||
.try_into_http_request::<BytesMut>(&dest, SendAccessToken::IfRequired(""), &VERSIONS)
|
.try_into_http_request::<BytesMut>(&dest, SendAccessToken::IfRequired(""), &VERSIONS)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
|
|
|
@ -14,6 +14,8 @@ pub(crate) async fn send_request<T>(registration: Registration, request: T) -> R
|
||||||
where
|
where
|
||||||
T: OutgoingRequest + Debug,
|
T: OutgoingRequest + Debug,
|
||||||
{
|
{
|
||||||
|
const VERSIONS: [MatrixVersion; 1] = [MatrixVersion::V1_0];
|
||||||
|
|
||||||
let Some(dest) = registration.url else {
|
let Some(dest) = registration.url else {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
};
|
};
|
||||||
|
@ -21,9 +23,6 @@ where
|
||||||
trace!("Appservice URL \"{dest}\", Appservice ID: {}", registration.id);
|
trace!("Appservice URL \"{dest}\", Appservice ID: {}", registration.id);
|
||||||
|
|
||||||
let hs_token = registration.hs_token.as_str();
|
let hs_token = registration.hs_token.as_str();
|
||||||
|
|
||||||
const VERSIONS: [MatrixVersion; 1] = [MatrixVersion::V1_0];
|
|
||||||
|
|
||||||
let mut http_request = request
|
let mut http_request = request
|
||||||
.try_into_http_request::<BytesMut>(&dest, SendAccessToken::IfRequired(hs_token), &VERSIONS)
|
.try_into_http_request::<BytesMut>(&dest, SendAccessToken::IfRequired(hs_token), &VERSIONS)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue