chore (backend-rs): don't iterate the same process

This commit is contained in:
naskya 2024-05-19 12:49:45 +09:00
parent 797c768f24
commit c73ce2ff39
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C

View file

@ -176,6 +176,12 @@ pub async fn send_push_notification(
};
tracing::trace!("payload: {:#?}", payload);
let encoding = if kind == PushNotificationKind::Mastodon {
ContentEncoding::AesGcm
} else {
ContentEncoding::Aes128Gcm
};
for subscription in subscriptions.iter() {
if !subscription.send_read_message
&& [
@ -218,12 +224,6 @@ pub async fn send_push_notification(
continue;
}
let encoding = if kind == PushNotificationKind::Mastodon {
ContentEncoding::AesGcm
} else {
ContentEncoding::Aes128Gcm
};
let mut message_builder = WebPushMessageBuilder::new(&subscription_info);
message_builder.set_ttl(1000);
message_builder.set_payload(encoding, payload.as_bytes());