Skip to content

Better implementation for probe_info.json update to prevent corruption (#32)#33

Open
HUDASULTANA wants to merge 1 commit into
InternetHealthReport:masterfrom
HUDASULTANA:huda/32/probe_cache_fix
Open

Better implementation for probe_info.json update to prevent corruption (#32)#33
HUDASULTANA wants to merge 1 commit into
InternetHealthReport:masterfrom
HUDASULTANA:huda/32/probe_cache_fix

Conversation

@HUDASULTANA

Copy link
Copy Markdown

Currently, the tools.py script updates probe_info.json by overwriting or deleting the existing cache. If the script fails mid-execution, the JSON file can be left missing or corrupted.

This PR implements a safer approach:
-Fetch first, save later: The new probe data is fetched from the RIPE API.
-Validate JSON: Before replacing the old cache, the new JSON is validated to ensure it is correctly formatted.
-Atomic cache replacement: Only after successful validation is the old probe_info.json replaced with the new one.
-Existing cache usage: If a valid cache already exists, it is used to avoid unnecessary API calls.

Notes:

Some optional dependencies (py-radix) or the geolocations_ipmap.csv.bz2 file may be missing. They are not required for this fix >>and will not break the cache update.
This change is fully backward-compatible; it does not modify other parts of the repo.

@HUDASULTANA HUDASULTANA force-pushed the huda/32/probe_cache_fix branch from 5c9a752 to 11b3907 Compare September 9, 2025 20:07
@HUDASULTANA

Copy link
Copy Markdown
Author

@romain-fontugne,
I’m a fresher and this is my first contribution to open source. I’d be grateful if you could kindly review my PR.
Please let me know if there are any issues or improvements I can make .

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.

1 participant