Skip to content

Commit

Permalink
f r's
Browse files Browse the repository at this point in the history
* use standardized `platform` string for gcm to fcm transmission
  • Loading branch information
jrconlin committed Oct 2, 2023
1 parent d0bf8ec commit 628eade
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion autoendpoint/src/routers/fcm/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ pub mod tests {
async fn unknown_fcm_error() {
let client = make_client(FcmServerCredential {
project_id: PROJECT_ID.to_owned(),
is_gcm: Some(false),
is_gcm: Some(true),
server_access_token: make_service_key(),
})
.await;
Expand Down
20 changes: 8 additions & 12 deletions autoendpoint/src/routers/fcm/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,28 +188,24 @@ impl Router for FcmRouter {
// that this is a fragile relationship and so GCM errors do not immediately drop the
// remote user's endpoint (potentially causing a UA reset.)
//
trace!(
"Sending message to {platform}: [{:?}]",
&app_id,
platform = if client.is_gcm { "GCM as FCM" } else { "FCM" }
);
let platform = if client.is_gcm {
"gcm_as_fcmv1"
} else {
"fcmv1"
};
trace!("Sending message to {platform}: [{:?}]", &app_id);
if let Err(e) = client.send(message_data, routing_token, ttl).await {
return Err(handle_error(
e,
&self.metrics,
self.db.as_ref(),
if client.is_gcm { "gcm_as_fcm" } else { "fcm" },
platform,
&app_id,
notification.subscription.user.uaid,
)
.await);
};
incr_success_metrics(
&self.metrics,
if client.is_gcm { "gcm_as_fcm" } else { "fcm" },
&app_id,
notification,
);
incr_success_metrics(&self.metrics, platform, &app_id, notification);
// Sent successfully, update metrics and make response
trace!("Send request was successful");

Expand Down

0 comments on commit 628eade

Please sign in to comment.