Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hxbb00
Copy link
Contributor

@hxbb00 hxbb00 commented Jan 15, 2025

empty layer will never reload cache after the external program inserts the data

empty layer will never reload cache after the external program inserts the data
@github-actions github-actions bot added this to the 3.42.0 milestone Jan 15, 2025
Copy link

github-actions bot commented Jan 15, 2025

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit 406e60e)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit 406e60e)

@rouault
Copy link
Contributor

rouault commented Jan 16, 2025

@elpaso might want to review this. I see the test you want to remove was added in d2c317a

@hxbb00
Copy link
Contributor Author

hxbb00 commented Jan 16, 2025

pull_60154_2025-01-16_14-15-43

Copy link
Contributor

@troopa81 troopa81 left a 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();
Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor Author

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)?

Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants