-
Notifications
You must be signed in to change notification settings - Fork 4
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
[INV-3630] cache download stops in progress, start emancipating from Redux State #3782
base: dev
Are you sure you want to change the base?
Conversation
…urn to download functions
Looks reasonable to me |
084d8a0
to
b96c14d
Compare
3a35fb3
to
c702f4d
Compare
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.
Highlighted some of the weird code that is there until the second pass is complete.
This is done in two passes to
- Avoid a massive PR with differing goals
- Keep focus on the original goal here:
- Caching to Db
- removing a bug in the downloads
- being able to stop a download in progress
if (action.error.message === 'Early Exit') { | ||
draftState.recordSets[action.meta.arg.setId].cacheMetadata = { | ||
status: UserRecordCacheStatus.NOT_CACHED | ||
}; |
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.
Checks like these are for while we are managing the Two states [Redux / DB] And will be removed in next iteration
if (spec.recordSetType === RecordSetType.Activity && (await this.downloadActivity(args))) { | ||
Object.assign(responseData, await this.loadRecordsetSourceMetadata(spec.idsToCache)); | ||
} else if (spec.recordSetType === RecordSetType.IAPP && (await this.downloadIapp(args))) { | ||
Object.assign(responseData, await this.loadIappRecordsetSourceMetadata(spec.idsToCache)); | ||
} else { | ||
this.deleteRepository(spec.setId); | ||
throw Error('Early Exit'); | ||
} |
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.
The thrown error is temporary until Second pass is completed
Download functions return a true on success (Early exit is considered a failure)
We intentionally throw an Error in the false since the cache was abandoned and we don't want to update the Redux state. Now the Thunk will fail, and this specific error gets consumed so the user is none the wiser
Quality Gate failedFailed conditions |
Details
This PR Includes the following changes:
Important
This PR Starts the process of moving Redux Recordset metadata into DB storage. In the meantime both states (Redux and DB) have to be stored. Next iteration will be removing the redux data, keeping one source of truth. You may find weird consistencies and Error checks while both states are being managed.
Testing
Tested the Following
Tip
Additional Context: We don't download duplicate records, so when deleting we use a frequency map to ensure we don't delete Records used in multiple places
Testing was done in both Firefox and the Simulator
Sum of records and Cache metadata was manually verified and counted through queries in their respective storages.