Improve logging around message sending and processing.

This commit is contained in:
Greyson Parrelli
2021-09-15 12:24:42 -04:00
committed by Alex Hart
parent cdf8e4e1ed
commit 1031a4e96c
3 changed files with 24 additions and 23 deletions

View File

@@ -23,8 +23,7 @@ import java.util.concurrent.TimeUnit
* Logs are very performance critical. Even though this database is written to on a low-priority background thread, we want to keep throughput high and ensure
* that we aren't creating excess garbage.
*
* This is it's own separate physical database, so it cannot do joins or queries with any other
* tables.
* This is it's own separate physical database, so it cannot do joins or queries with any other tables.
*/
class LogDatabase private constructor(
application: Application,
@@ -46,7 +45,7 @@ class LogDatabase private constructor(
private val MAX_FILE_SIZE = ByteUnit.MEGABYTES.toBytes(15)
private val DEFAULT_LIFESPAN = TimeUnit.DAYS.toMillis(2)
private val LONGER_LIFESPAN = TimeUnit.DAYS.toMillis(7)
private val LONGER_LIFESPAN = TimeUnit.DAYS.toMillis(14)
private const val DATABASE_VERSION = 2
private const val DATABASE_NAME = "signal-logs.db"

View File

@@ -238,7 +238,7 @@ public final class MessageContentProcessor {
PendingRetryReceiptModel pending = ApplicationDependencies.getPendingRetryReceiptCache().get(senderRecipient.getId(), content.getTimestamp());
long receivedTime = handlePendingRetry(pending, content, threadRecipient);
log(String.valueOf(content.getTimestamp()), "Beginning message processing.");
log(String.valueOf(content.getTimestamp()), "Beginning message processing. Sender: " + senderRecipient.getId() + " | " + senderRecipient.requireServiceId());
if (content.getDataMessage().isPresent()) {
GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(context);
@@ -439,7 +439,7 @@ public final class MessageContentProcessor {
Optional<GroupRecord> groupRecord = groupDatabase.getGroup(groupId);
if (groupRecord.isPresent() && !groupRecord.get().getMembers().contains(senderRecipient.getId())) {
log(String.valueOf(content.getTimestamp()), "Ignoring GV2 message from member not in group " + groupId);
log(String.valueOf(content.getTimestamp()), "Ignoring GV2 message from member not in group " + groupId + ". Sender: " + senderRecipient.getId() + " | " + senderRecipient.requireServiceId());
return true;
}
@@ -1769,7 +1769,7 @@ public final class MessageContentProcessor {
GroupId.Push groupId = GroupId.push(typingMessage.getGroupId().get());
if (!DatabaseFactory.getGroupDatabase(context).isCurrentMember(groupId, senderRecipient.getId())) {
warn(String.valueOf(content.getTimestamp()), "Seen typing indicator for non-member");
warn(String.valueOf(content.getTimestamp()), "Seen typing indicator for non-member " + senderRecipient.getId());
return;
}