GlobalMessageIdsTable: added assert

This commit is contained in:
Peter Iakovlev 2019-03-21 18:54:34 +04:00
parent f564c6ad01
commit 78c67b658a
2 changed files with 9 additions and 2 deletions

View File

@ -14,6 +14,7 @@ final class GlobalMessageIdsTable: Table {
} }
func set(_ globalId: Int32, id: MessageId) { func set(_ globalId: Int32, id: MessageId) {
assert(self.get(globalId) == nil)
self.sharedBuffer.reset() self.sharedBuffer.reset()
var idPeerId: Int64 = id.peerId.toInt64() var idPeerId: Int64 = id.peerId.toInt64()
var idNamespace: Int32 = id.namespace var idNamespace: Int32 = id.namespace

View File

@ -996,9 +996,11 @@ public func openPostbox(basePath: String, seedConfiguration: SeedConfiguration)
#if DEBUG #if DEBUG
//debugSaveState(basePath: basePath, name: "previous1") //debugSaveState(basePath: basePath, name: "previous1")
//debugRestoreState(basePath: basePath, name: "previous1") debugRestoreState(basePath: basePath, name: "previous1")
#endif #endif
var debugFirstTime = true
loop: while true { loop: while true {
let valueBox = SqliteValueBox(basePath: basePath + "/db", queue: queue) let valueBox = SqliteValueBox(basePath: basePath + "/db", queue: queue)
@ -1007,7 +1009,11 @@ public func openPostbox(basePath: String, seedConfiguration: SeedConfiguration)
let userVersion: Int32? = metadataTable.userVersion() let userVersion: Int32? = metadataTable.userVersion()
let currentUserVersion: Int32 = 19 let currentUserVersion: Int32 = 19
if let userVersion = userVersion { if var userVersion = userVersion {
/*if debugFirstTime {
debugFirstTime = false
userVersion = 18
}*/
if userVersion != currentUserVersion { if userVersion != currentUserVersion {
if userVersion > currentUserVersion { if userVersion > currentUserVersion {
postboxLog("Version \(userVersion) is newer than supported") postboxLog("Version \(userVersion) is newer than supported")