Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3338667
D13659.id45010.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13659.id45010.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
Fri, Nov 22, 6:31 PM (16 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2561423
Default Alt Text
D13659.id45010.diff (2 KB)
Attached To
Mode
D13659: [Tunnelbroker] deprecate errors about invalidating device token
Attached
Detach File
Event Timeline
Log In to Comment