Fix missed case

pull/296/head
nielsandriesse 5 years ago
parent 54e315f00d
commit 60552eac2d

@ -218,8 +218,12 @@ public enum OnionRequestAPI {
print("[Test] [drop(_ path: Path)] newPaths: \(paths)") print("[Test] [drop(_ path: Path)] newPaths: \(paths)")
self.paths = paths self.paths = paths
try! Storage.writeSync { transaction in try! Storage.writeSync { transaction in
print("[Loki] Persisting onion request paths to database.") if !paths.isEmpty {
Storage.setOnionRequestPaths(paths, using: transaction) print("[Loki] Persisting onion request paths to database.")
Storage.setOnionRequestPaths(paths, using: transaction)
} else {
Storage.clearOnionRequestPaths(using: transaction)
}
} }
} }

@ -41,4 +41,8 @@ public extension Storage {
print("[Test] [getOnionRequestPaths()] result: \(result)") print("[Test] [getOnionRequestPaths()] result: \(result)")
return result return result
} }
internal static func clearOnionRequestPaths(using transaction: YapDatabaseReadWriteTransaction) {
transaction.removeAllObjects(inCollection: onionRequestPathCollection)
}
} }

Loading…
Cancel
Save