Rework refresh_vgrid_map in order to address a potential race and missing field init
#380
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rework
refresh_vgrid_mapin order to init all vgrid entries inVGRIDSearly and to never skip init of the individual fields in those vgrid dicts, even if the source file for the corresponding field (likeownersormembers) is older than the map timestamp of the current vgrid map file. That should address a potential race when vgrids are modified during long-running refresh calls and any other causes for those fields missing in the existing map.Extend the same idea to cover the
RESOURCESandUSERSupdate in the same function to make sure all parts of the vgrid map get properly initialized in such corner cases.Remove an unused leftover variable in check_vgrid_access while at it.
These issues were discovered during unit test implementation in PR #372 and appears to be the source of the spurious CI failures about missing vgrid map
__owners__in that PR e.g. seen inhttps://github.com/ucphhpc/migrid-sync/actions/runs/19012212737/job/54294834829?pr=372
Similarly the extension to also cover
RESOURCESandUSERSappears to address the spurious CI failures about theRESOURCESpart of the vgrid map sometimes incorrectly left empty e.g. inhttps://github.com/ucphhpc/migrid-sync/actions/runs/19012954138/job/54296573680?pr=372#step:6:126
Especially the former may also be involved in issue #121 where similar mechanics could explain the intermittent loss of owner access.