Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3509229
D13969.id46020.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
D13969.id46020.diff
View Options
diff --git a/services/tunnelbroker/src/notifs/wns/mod.rs b/services/tunnelbroker/src/notifs/wns/mod.rs
--- a/services/tunnelbroker/src/notifs/wns/mod.rs
+++ b/services/tunnelbroker/src/notifs/wns/mod.rs
@@ -69,14 +69,19 @@
.text()
.await
.unwrap_or_else(|error| format!("Error occurred: {}", error));
- tracing::error!(
- errorType = error_types::WNS_ERROR,
- "Failed sending WNS notification to: {}. Status: {}. Body: {}",
- &url,
- error_status,
- body
- );
- let wns_error = WNSErrorResponse::from_status(error_status, body);
+ let wns_error =
+ WNSErrorResponse::from_status(error_status, body.clone());
+
+ if !wns_error.should_invalidate_token() {
+ tracing::error!(
+ errorType = error_types::WNS_ERROR,
+ "Failed sending WNS notification to: {}. Status: {}. Body: {}",
+ &url,
+ error_status,
+ body
+ );
+ }
+
Err(error::Error::WNSNotification(wns_error))
}
}
diff --git a/services/tunnelbroker/src/notifs/wns/response.rs b/services/tunnelbroker/src/notifs/wns/response.rs
--- a/services/tunnelbroker/src/notifs/wns/response.rs
+++ b/services/tunnelbroker/src/notifs/wns/response.rs
@@ -74,4 +74,7 @@
_ => WNSErrorResponse::UnspecifiedError,
}
}
+ pub fn should_invalidate_token(&self) -> bool {
+ matches!(self, WNSErrorResponse::NotFound | WNSErrorResponse::Gone)
+ }
}
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::wns::response::WNSErrorResponse;
use comm_lib::aws::ddb::error::SdkError;
use comm_lib::aws::ddb::operation::put_item::PutItemError;
use derive_more;
@@ -715,8 +714,7 @@
let result = wns_client.send(wns_notif).await;
if let Err(NotifsWNSError(err)) = &result {
- if matches!(err, WNSErrorResponse::NotFound | WNSErrorResponse::Gone)
- {
+ if err.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
Sun, Dec 22, 2:44 AM (4 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2690226
Default Alt Text
D13969.id46020.diff (2 KB)
Attached To
Mode
D13969: [Tunnelbroker] deprecate errors about invalidating WNS device token
Attached
Detach File
Event Timeline
Log In to Comment