Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33334252
D13659.1768897159.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D13659.1768897159.diff
View Options
diff --git a/services/tunnelbroker/src/notifs/fcm/mod.rs b/services/tunnelbroker/src/notifs/fcm/mod.rs
--- a/services/tunnelbroker/src/notifs/fcm/mod.rs
+++ b/services/tunnelbroker/src/notifs/fcm/mod.rs
@@ -86,14 +86,20 @@
.text()
.await
.unwrap_or_else(|error| format!("Error occurred: {}", error));
- error!(
- errorType = error_types::FCM_ERROR,
- "Failed sending FCM notification to: {}. Status: {}. Body: {}",
- token,
- error_status,
- body
- );
- let fcm_error = FCMErrorResponse::from_status(error_status, body);
+
+ let fcm_error =
+ FCMErrorResponse::from_status(error_status, body.clone());
+
+ if !fcm_error.should_invalidate_token() {
+ error!(
+ errorType = error_types::FCM_ERROR,
+ "Failed sending FCM notification to: {}. Status: {}. Body: {}",
+ token,
+ error_status,
+ body
+ );
+ }
+
return Err(FCMError(fcm_error));
}
}
diff --git a/services/tunnelbroker/src/notifs/fcm/response.rs b/services/tunnelbroker/src/notifs/fcm/response.rs
--- a/services/tunnelbroker/src/notifs/fcm/response.rs
+++ b/services/tunnelbroker/src/notifs/fcm/response.rs
@@ -60,4 +60,11 @@
_ => FCMErrorResponse::UnspecifiedError,
}
}
+
+ pub fn should_invalidate_token(&self) -> bool {
+ matches!(
+ self,
+ FCMErrorResponse::Unregistered | FCMErrorResponse::InvalidArgument(_)
+ )
+ }
}
diff --git a/services/tunnelbroker/src/websockets/session.rs b/services/tunnelbroker/src/websockets/session.rs
--- a/services/tunnelbroker/src/websockets/session.rs
+++ b/services/tunnelbroker/src/websockets/session.rs
@@ -3,7 +3,6 @@
error_types, CLIENT_RMQ_MSG_PRIORITY, DDB_RMQ_MSG_PRIORITY,
MAX_RMQ_MSG_PRIORITY, RMQ_CONSUMER_TAG,
};
-use crate::notifs::fcm::response::FCMErrorResponse;
use crate::notifs::wns::response::WNSErrorResponse;
use comm_lib::aws::ddb::error::SdkError;
use comm_lib::aws::ddb::operation::put_item::PutItemError;
@@ -600,11 +599,7 @@
let result = fcm.send(fcm_message).await;
if let Err(NotifsFCMError(fcm_error)) = &result {
- if matches!(
- fcm_error,
- FCMErrorResponse::Unregistered
- | FCMErrorResponse::InvalidArgument(_)
- ) {
+ if fcm_error.should_invalidate_token() {
if let Err(e) = self
.invalidate_device_token(notif.device_id, device_token.clone())
.await
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 20, 8:19 AM (10 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5960001
Default Alt Text
D13659.1768897159.diff (2 KB)
Attached To
Mode
D13659: [Tunnelbroker] deprecate errors about invalidating device token
Attached
Detach File
Event Timeline
Log In to Comment