Improve logging for remapped recipients.
This commit is contained in:
parent
e1489bb407
commit
31e3e37c9b
2 changed files with 6 additions and 1 deletions
|
@ -701,7 +701,7 @@ public class RecipientDatabase extends Database {
|
||||||
} else {
|
} else {
|
||||||
Optional<RecipientId> remapped = RemappedRecords.getInstance().getRecipient(context, id);
|
Optional<RecipientId> remapped = RemappedRecords.getInstance().getRecipient(context, id);
|
||||||
if (remapped.isPresent()) {
|
if (remapped.isPresent()) {
|
||||||
Log.w(TAG, "Missing recipient, but found it in the remapped records.");
|
Log.w(TAG, "Missing recipient for " + id + ", but found it in the remapped records as " + remapped.get());
|
||||||
return getRecipientSettings(remapped.get());
|
return getRecipientSettings(remapped.get());
|
||||||
} else {
|
} else {
|
||||||
throw new MissingRecipientException(id);
|
throw new MissingRecipientException(id);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Context;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import org.signal.core.util.logging.Log;
|
||||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||||
import org.whispersystems.libsignal.util.guava.Optional;
|
import org.whispersystems.libsignal.util.guava.Optional;
|
||||||
|
|
||||||
|
@ -23,6 +24,8 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
class RemappedRecords {
|
class RemappedRecords {
|
||||||
|
|
||||||
|
private static final String TAG = Log.tag(RemappedRecords.class);
|
||||||
|
|
||||||
private static final RemappedRecords INSTANCE = new RemappedRecords();
|
private static final RemappedRecords INSTANCE = new RemappedRecords();
|
||||||
|
|
||||||
private Map<RecipientId, RecipientId> recipientMap;
|
private Map<RecipientId, RecipientId> recipientMap;
|
||||||
|
@ -48,6 +51,7 @@ class RemappedRecords {
|
||||||
* Can only be called inside of a transaction.
|
* Can only be called inside of a transaction.
|
||||||
*/
|
*/
|
||||||
void addRecipient(@NonNull Context context, @NonNull RecipientId oldId, @NonNull RecipientId newId) {
|
void addRecipient(@NonNull Context context, @NonNull RecipientId oldId, @NonNull RecipientId newId) {
|
||||||
|
Log.w(TAG, "[Recipient] Remapping " + oldId + " to " + newId);
|
||||||
ensureInTransaction(context);
|
ensureInTransaction(context);
|
||||||
ensureRecipientMapIsPopulated(context);
|
ensureRecipientMapIsPopulated(context);
|
||||||
recipientMap.put(oldId, newId);
|
recipientMap.put(oldId, newId);
|
||||||
|
@ -58,6 +62,7 @@ class RemappedRecords {
|
||||||
* Can only be called inside of a transaction.
|
* Can only be called inside of a transaction.
|
||||||
*/
|
*/
|
||||||
void addThread(@NonNull Context context, long oldId, long newId) {
|
void addThread(@NonNull Context context, long oldId, long newId) {
|
||||||
|
Log.w(TAG, "[Thread] Remapping " + oldId + " to " + newId);
|
||||||
ensureInTransaction(context);
|
ensureInTransaction(context);
|
||||||
ensureThreadMapIsPopulated(context);
|
ensureThreadMapIsPopulated(context);
|
||||||
threadMap.put(oldId, newId);
|
threadMap.put(oldId, newId);
|
||||||
|
|
Loading…
Add table
Reference in a new issue