nroi / flexo

a central pacman cache
MIT License
172 stars 10 forks source link

Panic on nonexistent `latency_test_results.json` due to invalid status.json format #96

Open ZoomRmc opened 1 year ago

ZoomRmc commented 1 year ago

If the file latency_test_results.json is not found, Flexo panics with:

[2022-10-09T15:23:34.018Z INFO  flexo::mirror_flexo] Retrieved 0 files with a total size of 0.00 B from local file system.
[2022-10-09T15:23:41.435Z INFO  flexo] Unable to fetch mirrors remotely: DemarshallError(Error("invalid type: map, expected a sequence", line: 1, column: 1))
    Will try to fetch them from cache.
thread 'main' panicked at 'Unable to fetch mirrors from cache: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })', src/main.rs:678:19

Got that while trying to provide the status.json endpoint from Manjaro (which have a different format). Flexo shouldn't panic here, as it's still possible to fall back on to provided mirrors_predefined vec from the config.

PS: Supporting Manjaro repo list would be a welcome addition, though it grants a separate issue.

nroi commented 1 year ago

Thanks for reporting this. You can, of course, just set the mirror_selection_method to predefined. But using the predefined mirrors as a fallback would more robust and also compliant with the comments in the flexo.toml file, so this is something I am going to change.

I've created a separate issue for Manjaro support: https://github.com/nroi/flexo/issues/97