Page MenuHomePhabricator

D12909.diff
No OneTemporary

D12909.diff

diff --git a/services/tunnelbroker/src/database/mod.rs b/services/tunnelbroker/src/database/mod.rs
--- a/services/tunnelbroker/src/database/mod.rs
+++ b/services/tunnelbroker/src/database/mod.rs
@@ -257,4 +257,33 @@
Ok(())
}
+
+ pub async fn mark_device_token_as_invalid(
+ &self,
+ device_id: &str,
+ ) -> Result<(), Error> {
+ let update_expression =
+ format!("SET {0} = :val", device_tokens::TOKEN_INVALID);
+
+ self
+ .client
+ .update_item()
+ .table_name(device_tokens::TABLE_NAME)
+ .key(
+ device_tokens::DEVICE_ID,
+ AttributeValue::S(device_id.to_string()),
+ )
+ .update_expression(update_expression)
+ .expression_attribute_values(":val", AttributeValue::Bool(true))
+ .send()
+ .await
+ .map_err(|e| {
+ error!(
+ "DynamoDB client failed to mark device token as invalid {:?}",
+ e
+ );
+ Error::AwsSdk(e.into())
+ })?;
+ Ok(())
+ }
}

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 26, 10:53 PM (9 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2709317
Default Alt Text
D12909.diff (991 B)

Event Timeline