Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public void initialize() {

FirebaseOptions options = FirebaseOptions.builder()
.setCredentials(GoogleCredentials.fromStream(credentialsStream))
.setConnectTimeout(15000)
.setReadTimeout(10000)
.setWriteTimeout(10000)
Comment thread
kryakobess marked this conversation as resolved.
.build();

FirebaseApp.initializeApp(options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
import ru.randomwalk.twitterservice.service.DeviceService;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.Executors;

Expand Down Expand Up @@ -51,13 +53,15 @@ private void sendMessage(Notification notification, Device device, Map<String, S
Message message = Message.builder()
.setNotification(notification)
.setToken(device.getDeviceToken())
.putAllData(additionalData)
.putAllData(Objects.requireNonNullElseGet(additionalData, HashMap::new))

Copilot AI May 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding a log warning when additionalData is null to help trace cases where expected data is missing.

Copilot uses AI. Check for mistakes.
.build();
String messageId = FirebaseMessaging.getInstance().send(message);
log.info("Message {} were sent with id {}", message, messageId);
} catch (FirebaseMessagingException firebaseException) {
log.warn("Error sending notification {}", notification, firebaseException);
expireToken(firebaseException, device);
} catch (Exception e) {
log.error("Exception in task with virtual thread", e);
}
}

Expand Down
Loading