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 {
|
||||
Optional<RecipientId> remapped = RemappedRecords.getInstance().getRecipient(context, id);
|
||||
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());
|
||||
} else {
|
||||
throw new MissingRecipientException(id);
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
|
@ -23,6 +24,8 @@ import java.util.Map;
|
|||
*/
|
||||
class RemappedRecords {
|
||||
|
||||
private static final String TAG = Log.tag(RemappedRecords.class);
|
||||
|
||||
private static final RemappedRecords INSTANCE = new RemappedRecords();
|
||||
|
||||
private Map<RecipientId, RecipientId> recipientMap;
|
||||
|
@ -48,6 +51,7 @@ class RemappedRecords {
|
|||
* Can only be called inside of a transaction.
|
||||
*/
|
||||
void addRecipient(@NonNull Context context, @NonNull RecipientId oldId, @NonNull RecipientId newId) {
|
||||
Log.w(TAG, "[Recipient] Remapping " + oldId + " to " + newId);
|
||||
ensureInTransaction(context);
|
||||
ensureRecipientMapIsPopulated(context);
|
||||
recipientMap.put(oldId, newId);
|
||||
|
@ -58,6 +62,7 @@ class RemappedRecords {
|
|||
* Can only be called inside of a transaction.
|
||||
*/
|
||||
void addThread(@NonNull Context context, long oldId, long newId) {
|
||||
Log.w(TAG, "[Thread] Remapping " + oldId + " to " + newId);
|
||||
ensureInTransaction(context);
|
||||
ensureThreadMapIsPopulated(context);
|
||||
threadMap.put(oldId, newId);
|
||||
|
|
Loading…
Add table
Reference in a new issue