Skip to content

Commit

Permalink
Handle upserting single order in background
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmeichigo committed Oct 3, 2024
1 parent bd18b8b commit e25b11b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Yosemite/Yosemite/Stores/OrderStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ private extension OrderStore {
let storageOrder = storageManager.viewStorage.loadOrder(siteID: readOnlyOrder.siteID, orderID: readOnlyOrder.orderID)
let oldReadOnlyOrder = storageOrder?.toReadOnly()

upsertStoredOrders(readOnlyOrders: [readOnlyOrder], in: storageManager.viewStorage)
upsertStoredOrdersInBackground(readOnlyOrders: [readOnlyOrder])

if storageOrder == nil {
DDLogWarn("⚠️ Unable to retrieve stored order with ID \(readOnlyOrder.orderID) to be updated - A new order has been stored as a workaround")
Expand Down Expand Up @@ -655,7 +655,7 @@ private extension OrderStore {
///
private func upsertStoredOrdersInBackground(readOnlyOrders: [Networking.Order],
removeAllStoredOrders: Bool = false,
onCompletion: @escaping () -> Void) {
onCompletion: (() -> Void)? = nil) {
storageManager.performAndSave({ [weak self] derivedStorage in
guard let self else { return }
if removeAllStoredOrders {
Expand Down

0 comments on commit e25b11b

Please sign in to comment.