fix: don't use cache for fetching objects and files by default#272
Merged
fix: don't use cache for fetching objects and files by default#272
Conversation
Thanks for opening this pull request!
|
Codecov Report
@@ Coverage Diff @@
## main #272 +/- ##
==========================================
- Coverage 82.34% 82.25% -0.10%
==========================================
Files 102 102
Lines 10525 10575 +50
==========================================
+ Hits 8667 8698 +31
- Misses 1858 1877 +19
Continue to review full report at Codecov.
|
Contributor
Author
|
@vdkdamian can you try out this branch? Note that it will only fix your problem if was related to the caching I mentioned in #226 (comment) and #226 (comment). If this doesn't fix your issue, then you will have to look in other places in your code and SDK. |
Contributor
|
@cbaker6 This solves my issue! I tested it multiple times on iOS, then multiple times on macOS. Everything is working fine for me now. |
7 tasks
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New Pull Request Checklist
Issue Description
When objects or files are being “fetched”, they sometimes leverage the OS level cache and pull from cache if there was a cache hit. This can lead to unintended behavior as when a “fetch” is used, it implies fresh data from the server.
In addition, when caching a file that was downloaded via the SDK, the temporary file location is cached instead the new location the file was moved to. This results in a cache hit, but points to a file location that’s no longer valid.
Related issue: #226
Approach
For "fetching", the default cache policy is set for all
ParseObject's andParseFile's to not use cache. If the developer wants to use cache, they should pass the respective cache policy intooptionswhen calling the respective fetch method. The default cache policy for the SDK can be changed by the developer if needed:Parse-Swift/Sources/ParseSwift/Parse.swift
Lines 33 to 37 in a64726f
When fetching
ParseFile, cache the final location the file was moved to instead of the temporary locationTODOs before merging