-
-
Notifications
You must be signed in to change notification settings - Fork 441
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
Fix removeCacheFile #469
Fix removeCacheFile #469
Conversation
@martijn00 pls merge it, clearing files doesn't work at all |
@@ -184,7 +183,7 @@ class CacheStore { | |||
if (_futureCache.containsKey(cacheObject.key)) { | |||
await _futureCache.remove(cacheObject.key); | |||
} | |||
final file = io.File(cacheObject.relativePath); | |||
final file = await fileSystem.createFile(cacheObject.relativePath); |
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'm not sure this is correct. The old code only creates a reference to the file, and this code actually creates the file. So the check for the file will always be true, which is not correct.
Might there be a problem in your own code?
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.
@martijn00
But the file reference leads to old code that never points to the actual file, resulting in a constant accumulation of files in the cache.
Is there a possible mistake in the name of the method itself? For example, the _fileExists
method uses the same fileSystem.createFile
to check for the existence of a file.
test code:
result:
1. |
Same problem. File will never be deleted. final file = io.File(cacheObject.relativePath);
if (file.existsSync()) {
} Previous code will fix that. final file = await fileSystem.createFile(cacheObject.relativePath); |
Reference #387 |
@SmartVive can you add some more tests to make sure the behaviour is verified? |
@martijn00 Do you mean adding unit tests? I did, but I'm not good at them. |
✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)
fix removeCacheFile
removeCacheFile not working. because file dir is wrong.
🆕 What is the new behavior (if this is a feature change)?
removeCacheFile is working.
💥 Does this PR introduce a breaking change?
no
🐛 Recommendations for testing
📝 Links to relevant issues/docs
🤔 Checklist before submitting