fix a crash when the network clock offset is negative

pull/941/head
Ryan Zhao 1 year ago
parent e78b41164c
commit b05bb7f9bd

@ -110,7 +110,7 @@ public extension DisappearingMessagesJob {
let userPublicKey: String = getUserHexEncodedPublicKey(db)
let updateExpiryPublishers: [AnyPublisher<[String: UpdateExpiryResponseResult], Error>] = interactionExpirationInfosByExpiresInSeconds
.map { expiresInSeconds, expirationInfos -> AnyPublisher<[String: UpdateExpiryResponseResult], Error> in
let expirationTimestampMs: UInt64 = UInt64(ceil(startedAtMs + expiresInSeconds * 1000))
let expirationTimestampMs: Int64 = Int64(ceil(startedAtMs + expiresInSeconds * 1000))
return SnodeAPI
.updateExpiry(

@ -794,7 +794,7 @@ public final class SnodeAPI {
public static func updateExpiry(
publicKey: String,
serverHashes: [String],
updatedExpiryMs: UInt64,
updatedExpiryMs: Int64,
shortenOnly: Bool? = nil,
extendOnly: Bool? = nil,
using dependencies: SSKDependencies = SSKDependencies()
@ -810,7 +810,7 @@ public final class SnodeAPI {
.eraseToAnyPublisher()
}
let updatedExpiryMsWithNetworkOffset: UInt64 = (updatedExpiryMs + UInt64(SnodeAPI.clockOffsetMs.wrappedValue))
let updatedExpiryMsWithNetworkOffset: UInt64 = UInt64(updatedExpiryMs + SnodeAPI.clockOffsetMs.wrappedValue)
return getSwarm(for: publicKey)
.subscribe(on: Threading.workQueue)

Loading…
Cancel
Save