Skip to content

Commit

Permalink
Run mobile push requests in background
Browse files Browse the repository at this point in the history
  • Loading branch information
quexten committed Jun 13, 2023
1 parent bd883de commit 8472104
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/api/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,17 @@ async fn send_to_push_relay(data: Value) {
};

let auth_header = format!("Bearer {}", &auth_push_token);

if let Err(e) = get_reqwest_client()
.post(CONFIG.push_relay_uri() + "/push/send")
.header(ACCEPT, "application/json")
.header(CONTENT_TYPE, "application/json")
.header(AUTHORIZATION, auth_header)
.json(&data)
.send()
.await
{
error!("An error occured while sending a send update to the push relay: {}", e);
};
tokio::task::spawn(async move {
if let Err(e) = get_reqwest_client()
.post(CONFIG.push_relay_uri() + "/push/send")
.header(ACCEPT, "application/json")
.header(CONTENT_TYPE, "application/json")
.header(AUTHORIZATION, auth_header)
.json(&data)
.send()
.await
{
error!("An error occured while sending a send update to the push relay: {}", e);
};
});
}

0 comments on commit 8472104

Please sign in to comment.