Fallback to using mappings in database if something goes wrong.

pull/56/head
Mikunj 6 years ago
parent 5047a98990
commit 2dd0634a62

@ -96,6 +96,13 @@ public final class LokiStorageAPI : LokiDotNetAPI {
storage.setDeviceLinks(deviceLinks, in: transaction)
}
return deviceLinks
}.recover { _ -> Promise<Set<DeviceLink>> in
// If we error out at any time then fallback to the device links we have in storage
var deviceLinks = Set<DeviceLink>()
storage.dbReadConnection.read { transaction in
deviceLinks = storage.getDeviceLinks(for: hexEncodedPublicKey, in: transaction)
}
return Promise.value(deviceLinks)
}
}
}

Loading…
Cancel
Save