Fix instrumentation for re-registration of recently-deleted accounts
This commit is contained in:
parent
ae976ef8d6
commit
162b27323e
|
@ -196,9 +196,12 @@ public class AccountsManager {
|
||||||
|
|
||||||
account.setNumber(number, phoneNumberIdentifiers.getPhoneNumberIdentifier(number));
|
account.setNumber(number, phoneNumberIdentifiers.getPhoneNumberIdentifier(number));
|
||||||
|
|
||||||
|
final Optional<UUID> maybeRecentlyDeletedAccountIdentifier =
|
||||||
|
accounts.findRecentlyDeletedAccountIdentifier(number);
|
||||||
|
|
||||||
// Reuse the ACI from any recently-deleted account with this number to cover cases where somebody is
|
// Reuse the ACI from any recently-deleted account with this number to cover cases where somebody is
|
||||||
// re-registering.
|
// re-registering.
|
||||||
account.setUuid(accounts.findRecentlyDeletedAccountIdentifier(number).orElseGet(UUID::randomUUID));
|
account.setUuid(maybeRecentlyDeletedAccountIdentifier.orElseGet(UUID::randomUUID));
|
||||||
account.addDevice(device);
|
account.addDevice(device);
|
||||||
account.setRegistrationLockFromAttributes(accountAttributes);
|
account.setRegistrationLockFromAttributes(accountAttributes);
|
||||||
account.setUnidentifiedAccessKey(accountAttributes.getUnidentifiedAccessKey());
|
account.setUnidentifiedAccessKey(accountAttributes.getUnidentifiedAccessKey());
|
||||||
|
@ -245,10 +248,10 @@ public class AccountsManager {
|
||||||
|
|
||||||
if (freshUser) {
|
if (freshUser) {
|
||||||
tags = Tags.of("type", "new");
|
tags = Tags.of("type", "new");
|
||||||
} else if (!originalUuid.equals(actualUuid)) {
|
} else if (maybeRecentlyDeletedAccountIdentifier.isPresent()) {
|
||||||
tags = Tags.of("type", "re-registration");
|
|
||||||
} else {
|
|
||||||
tags = Tags.of("type", "recently-deleted");
|
tags = Tags.of("type", "recently-deleted");
|
||||||
|
} else {
|
||||||
|
tags = Tags.of("type", "re-registration");
|
||||||
}
|
}
|
||||||
|
|
||||||
Metrics.counter(CREATE_COUNTER_NAME, tags).increment();
|
Metrics.counter(CREATE_COUNTER_NAME, tags).increment();
|
||||||
|
|
Loading…
Reference in New Issue