-
Notifications
You must be signed in to change notification settings - Fork 121
[Woo POS][Local Catalog] Store full sync date on site entity #16115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Woo POS][Local Catalog] Store full sync date on site entity #16115
Conversation
|
|
jaclync
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀 mostly a comment about CIAB files.
| let updatedSite = POSSite( | ||
| siteID: siteID, | ||
| lastIncrementalSyncDate: currentSite?.lastIncrementalSyncDate, | ||
| lastFullSyncDate: Date() | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: how about the following in case the site properties grow?
| let updatedSite = POSSite( | |
| siteID: siteID, | |
| lastIncrementalSyncDate: currentSite?.lastIncrementalSyncDate, | |
| lastFullSyncDate: Date() | |
| ) | |
| let updatedSite = currentSite.toPOSSite().copy(lastFullSyncDate: Date()) |
| do { | ||
| try await persistenceService.updateSite(updatedSite) | ||
| } catch POSCatalogPersistenceError.siteNotFound { | ||
| // Site doesn't exist yet, this could happen if sync coordinator is called before replaceAllCatalogData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: fullSyncService.startFullSync above in the same function already calls persistenceService.replaceAllCatalogData, this case seems unexpected and maybe deserves an error log?
| 2DCB54FA2E6AE8E100621F90 /* CIABEligibilityChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DCB54F92E6AE8D800621F90 /* CIABEligibilityChecker.swift */; }; | ||
| 2DCB54FC2E6AFE6A00621F90 /* CIABAffectedFeature.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DCB54FB2E6AFE6900621F90 /* CIABAffectedFeature.swift */; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓Likely from merge conflicts from trunk, are these 2 files meant to be in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for spotting, fixed
| // Check if we have a stored site from updateSite calls | ||
| if let storedSite = storedSites[siteID] { | ||
| return storedSite | ||
| } | ||
|
|
||
| // Check if we have a specific result for this site | ||
| if let specificSite = siteResults[siteID] { | ||
| return specificSite | ||
| } | ||
|
|
||
| // Fall back to configured result | ||
| switch loadSiteResult { | ||
| case .success(let site): | ||
| return site | ||
| case .failure(let error): | ||
| throw error | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 this feels like a lot of ways to configure the mock setup, and could be tricky to debug. Feel free to leave it as it is and I can make some changes in my PR that will base on this branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've simplified it a lot by moving the sync date set to the transaction when we insert the catalog.
a467350 to
0ffe5d7
Compare

Merge after: #16108
Description
This PR moves the full sync date to the Site entity, to match incremental sync dates.
Steps to reproduce
Something like this should be logged:
RELEASE-NOTES.txtif necessary.