Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimising the DB Search #4388

Closed
wants to merge 5 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions crates/matrix-sdk-indexeddb/src/crypto_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1316,15 +1316,24 @@ impl_crypto_store! {

async fn get_room_settings(&self, room_id: &RoomId) -> Result<Option<RoomSettings>> {
let key = self.serializer.encode_key(keys::ROOM_SETTINGS, room_id);
self

// Get the transaction with the correct mode
let transaction = self
.inner
.transaction_on_one_with_mode(keys::ROOM_SETTINGS, IdbTransactionMode::Readonly)?
.transaction_on_one_with_mode(keys::ROOM_SETTINGS, IdbTransactionMode::Readonly)?;

// Get the object store and the value associated with the key
let result = transaction
.object_store(keys::ROOM_SETTINGS)?
.get(&key)?
.await?
.get(&key)?;

let value = result.await?;

// Deserialize and return the result, returning Option directly if there's no value
value
.map(|v| self.serializer.deserialize_value(v))
.transpose()
}
}

async fn get_custom_value(&self, key: &str) -> Result<Option<Vec<u8>>> {
self
Expand Down
Loading