-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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: empty vector layer reload() will never invalidate cache #60154
base: master
Are you sure you want to change the base?
fix: empty vector layer reload() will never invalidate cache #60154
Conversation
empty layer will never reload cache after the external program inserts the data
🪟 Windows buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
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.
Do you mind adding test?
mCacheOrderedKeys.clear(); | ||
mCacheUnorderedKeys.clear(); | ||
mFullCache = false; | ||
emit invalidated(); |
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.
We can keep the if condition and just get out the signal firing
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.
To be honest I cant' remember exactly but I suspect that part of the speed optimization of my original PR was to not fire the signal when the cache was not changed (because it was already empty) .
The fact here is that there are possibly many side effects when firing a signal and some of these can slow down the application significantly.
I would recommend to explore if are there other ways to fix the issue.
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.
However, the condition only blocks the signal when it is empty, and the signal is still emitted when it is not empty. Is it feasible to add if(mFullCache)
?
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.
@elpaso That would require then to be able to distinguish between an empty cache because of an empty layer, or an empty cache because cache has not been yet populated
empty layer will never reload cache after the external program inserts the data