-
Notifications
You must be signed in to change notification settings - Fork 61
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 file caching in JsonFileInterpreter. #452
base: 1.10
Are you sure you want to change the base?
Conversation
8389e66
to
40ad910
Compare
since this is a bugfix, please rebase to 1.10 |
just for the record: the file caching makes sense because methods |
40ad910
to
fb18690
Compare
|
@cancan101 @fashxp I think we should write the cache also in the loadData method and the fileValid should use the loadData method. Now it has redundant loading code. WDYT? |
I think there is more that can be done with the caching and I would also suggest reviewing the control flow for error handing (e.g. pass That said, these changes are becoming too much for me to take on. |
@@ -32,7 +32,7 @@ class JsonFileInterpreter extends AbstractInterpreter | |||
|
|||
protected function loadData(string $path): array | |||
{ | |||
if ($this->cachedFilePath === $path && !empty($this->cachedContent)) { | |||
if ($this->cachedFilePath !== $path || empty($this->cachedContent)) { |
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.
Variable exists always. We should compare it with null.
if ($this->cachedFilePath !== $path || empty($this->cachedContent)) { | |
if ($this->cachedFilePath !== $path || $this->cachedContent === null) { |
@blankse the suggestions might be easier after this PR: https://github.com/pimcore/data-importer/pull/437/files#diff-a36a911bb91e74bc3b35f4779ac1a1dd970ab78d93b7df9d4b2df64846259d9fR45-R57 with the load factored out and then can change such that both loads use that function. |
@cancan101 But there is also the error handling and the cache writing only in the fileValid method. I think this should be also moved in the loading method. |
yes see my linked PR and comment. |
JSON version of PR #438
Pulled out of #437 (comment)
CC @fashxp