Page MenuHomePhabricator

D13278.diff
No OneTemporary

D13278.diff

diff --git a/services/identity/src/database.rs b/services/identity/src/database.rs
--- a/services/identity/src/database.rs
+++ b/services/identity/src/database.rs
@@ -497,7 +497,14 @@
OlmAccountType::Notification,
true,
)
- .await?;
+ .await
+ .unwrap_or_else(|e| {
+ error!(
+ errorType = error_types::OTK_DB_LOG,
+ "Error retrieving notification one-time key: {:?}", e
+ );
+ (None, true)
+ });
let (content_one_time_key, _) = self
.get_one_time_key(
user_id,
@@ -505,7 +512,14 @@
OlmAccountType::Content,
!requested_more_keys,
)
- .await?;
+ .await
+ .unwrap_or_else(|e| {
+ error!(
+ errorType = error_types::OTK_DB_LOG,
+ "Error retrieving content one-time key: {:?}", e
+ );
+ (None, true)
+ });
debug!(
"Able to get notif one-time key for keyserver {}: {}",
@@ -787,7 +801,14 @@
OlmAccountType::Notification,
true,
)
- .await?;
+ .await
+ .unwrap_or_else(|e| {
+ error!(
+ errorType = error_types::OTK_DB_LOG,
+ "Error retrieving notification one-time key: {:?}", e
+ );
+ (None, true)
+ });
(device_keys.content_one_time_key, _) = self
.get_one_time_key(
user_id,
@@ -795,7 +816,14 @@
OlmAccountType::Content,
!requested_more_keys,
)
- .await?;
+ .await
+ .unwrap_or_else(|e| {
+ error!(
+ errorType = error_types::OTK_DB_LOG,
+ "Error retrieving content one-time key: {:?}", e
+ );
+ (None, true)
+ });
}
}
diff --git a/services/identity/src/database/one_time_keys.rs b/services/identity/src/database/one_time_keys.rs
--- a/services/identity/src/database/one_time_keys.rs
+++ b/services/identity/src/database/one_time_keys.rs
@@ -14,7 +14,7 @@
DBItemAttributeError, DBItemError,
},
};
-use tracing::{debug, error, info};
+use tracing::{debug, error, info, warn};
use crate::{
constants::{
@@ -94,7 +94,7 @@
.await?
.pop()
else {
- return Err(Error::NotEnoughOneTimeKeys);
+ return Ok((None, requested_more_keys));
};
let delete_otk_operation = otk_row.as_delete_request();
@@ -209,11 +209,7 @@
if let Some(limit) = num_keys {
if otk_rows.len() != limit {
- error!(
- errorType = error_types::OTK_DB_LOG,
- "There are fewer one-time keys than the number requested"
- );
- return Err(Error::NotEnoughOneTimeKeys);
+ warn!("There are fewer one-time keys than the number requested");
}
}
diff --git a/services/identity/src/error.rs b/services/identity/src/error.rs
--- a/services/identity/src/error.rs
+++ b/services/identity/src/error.rs
@@ -34,8 +34,6 @@
IllegalState,
#[display(...)]
InvalidFormat,
- #[display(...)]
- NotEnoughOneTimeKeys,
}
#[derive(Debug, derive_more::Display, derive_more::Error)]

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 4:43 PM (22 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2585508
Default Alt Text
D13278.diff (3 KB)

Event Timeline