[Messaging] Change notification to allow same id - #1910
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes the early return check in NotifyListenerOnRegistrationReceived that prevented notifying the listener if the incoming registration ID matched the previous one. The reviewer suggested an optimization to avoid redundant string assignments when the registration ID remains unchanged, while still proceeding with the notification.
| if (!g_prev_registration_received) | ||
| g_prev_registration_received = new std::string; | ||
| *g_prev_registration_received = installationId; |
There was a problem hiding this comment.
Since we want to allow sending the registration notification even if it is the same as the previous one, we can still optimize the string assignment. If g_prev_registration_received already contains the same installationId, we can skip the redundant string copy/assignment while still proceeding to notify the listener.
if (!g_prev_registration_received) {
g_prev_registration_received = new std::string(installationId);
} else if (*g_prev_registration_received != installationId) {
*g_prev_registration_received = installationId;
}
Integration test with FLAKINESS (succeeded after retry)Requested by @a-maurice on commit 33ab7a4
Add flaky tests to go/fpl-cpp-flake-tracker |
Description
To better align with how the underlying Android and iOS SDKs work, pass along the registration notification even if it is the same one that was sent earlier.
Testing
Type of Change
Place an
xthe applicable box:Notes
Release Notessection ofrelease_build_files/readme.md.