Fix a goof where the international unsealed sender country meter was incrementing unconditionally.

This commit is contained in:
Jon Chambers 2021-02-23 16:35:28 -05:00 committed by Jon Chambers
parent 6bff564129
commit 0ee3f0a5b5
1 changed files with 4 additions and 1 deletions

View File

@ -232,7 +232,10 @@ public class MessageController {
if (source.isPresent() && !source.get().isFor(destinationName)) {
rateLimiters.getMessagesLimiter().validate(source.get().getUuid() + "__" + destination.get().getUuid());
if (!Util.getCountryCode(source.get().getNumber()).equals(destination.get().getNumber())) {
final String senderCountryCode = Util.getCountryCode(source.get().getNumber());
final String destinationCountryCode = Util.getCountryCode(destination.get().getNumber());
if (!senderCountryCode.equals(destinationCountryCode)) {
Metrics.counter(INTERNATIONAL_UNSEALED_SENDER_COUNTER_NAME, SENDER_COUNTRY_TAG_NAME, Util.getCountryCode(source.get().getNumber())).increment();
}
}