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

Document.reorder: invalidate OcrdMets cache before save #58

Merged
merged 1 commit into from
Feb 20, 2023

Conversation

kba
Copy link
Contributor

@kba kba commented Dec 1, 2022

As discussed in OCR-D/core#957, the reorder method of Document changes the XML structure without OcrdMets being aware of it. We introduced optional caching of METS data in v2.42.0 and when enabled this led to inconsistency because OcrdMets.physical_pages did not reflect the changes because caching hid them.

@MehmedGIT therefore introduced a method OcrdMets.refresh_caches to refresh the cache from the XML.

This PR adds the refresh_caches call just before self.save_mets() which fixes the problem.

Also additonally run all tests with caching enabled to make sure we notice caching issues in the future.

@hnesk hnesk merged commit 0ce2772 into hnesk:master Feb 20, 2023
@hnesk
Copy link
Owner

hnesk commented Feb 20, 2023

@kba I'm really sorry that took so long, I had dayjob stuff to do and a broken ocrd/python/os-environment.

@kba kba deleted the refresh-caches-on-reorder branch February 22, 2023 12:35
@kba
Copy link
Contributor Author

kba commented Feb 22, 2023

@kba I'm really sorry that took so long, I had dayjob stuff to do and a broken ocrd/python/os-environment.

Not a problem, thanks for continuing to work on browse-ocrd, it has become my preferred tool to inspect/present OCR-D results and we're very happy to have it :-)

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.

2 participants