Skip to content

Commit 73b019f

Browse files
Refine decrypt deduplication.
1 parent ad1bdf4 commit 73b019f

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
lines changed

SignalServiceKit/Resources/schema.sql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,8 +1237,6 @@ CREATE
12371237
TABLE
12381238
IF NOT EXISTS "MessageDecryptDeduplication" (
12391239
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
1240-
,"envelopeTimestamp" INTEGER NOT NULL
1241-
,"serviceTimestamp" INTEGER NOT NULL
12421240
,"serverGuid" TEXT NOT NULL
12431241
)
12441242
;

SignalServiceKit/src/Messages/MessageProcessor.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -473,13 +473,9 @@ class MessageDecryptDeduplicationRecord: Codable, FetchableRecord, PersistableRe
473473
static let databaseTableName = "MessageDecryptDeduplication"
474474

475475
var id: Int64?
476-
let envelopeTimestamp: UInt64
477-
let serviceTimestamp: UInt64
478476
let serverGuid: String
479477

480-
init(envelopeTimestamp: UInt64, serviceTimestamp: UInt64, serverGuid: String) {
481-
self.envelopeTimestamp = envelopeTimestamp
482-
self.serviceTimestamp = serviceTimestamp
478+
init(serverGuid: String) {
483479
self.serverGuid = serverGuid
484480
}
485481

@@ -540,9 +536,7 @@ class MessageDecryptDeduplicationRecord: Codable, FetchableRecord, PersistableRe
540536
}
541537

542538
// No existing record found. Create a new one and insert it.
543-
let record = MessageDecryptDeduplicationRecord(envelopeTimestamp: envelopeTimestamp,
544-
serviceTimestamp: serviceTimestamp,
545-
serverGuid: serverGuid)
539+
let record = MessageDecryptDeduplicationRecord(serverGuid: serverGuid)
546540
try record.insert(transaction.unwrapGrdbWrite.database)
547541

548542
if !skipCull, shouldCull() {

SignalServiceKit/src/Storage/Database/GRDBSchemaMigrator.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public class GRDBSchemaMigrator: NSObject {
113113
case updateMessageSendLogColumnTypes
114114
case addRecordTypeIndex
115115
case tunedConversationLoadIndices
116-
case messageDecryptDeduplicationV4
116+
case messageDecryptDeduplicationV5
117117

118118
// NOTE: Every time we add a migration id, consider
119119
// incrementing grdbSchemaVersionLatest.
@@ -1446,7 +1446,7 @@ public class GRDBSchemaMigrator: NSObject {
14461446
}
14471447
}
14481448

1449-
migrator.registerMigration(MigrationId.messageDecryptDeduplicationV4.rawValue) { db in
1449+
migrator.registerMigration(MigrationId.messageDecryptDeduplicationV5.rawValue) { db in
14501450
do {
14511451
if try db.tableExists("MessageDecryptDeduplication") {
14521452
try db.drop(table: "MessageDecryptDeduplication")
@@ -1455,10 +1455,6 @@ public class GRDBSchemaMigrator: NSObject {
14551455
try db.create(table: "MessageDecryptDeduplication") { table in
14561456
table.autoIncrementedPrimaryKey("id")
14571457
.notNull()
1458-
table.column("envelopeTimestamp", .integer)
1459-
.notNull()
1460-
table.column("serviceTimestamp", .integer)
1461-
.notNull()
14621458
table.column("serverGuid", .text)
14631459
.notNull()
14641460
}

0 commit comments

Comments
 (0)