Skip to content

Commit

Permalink
better sorting for debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Aug 16, 2023
1 parent de344d5 commit 7f9fccf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fast-apt-mirror.sh
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ function find_fast_mirror() {
#
# filter out broken and outdated mirrors
#
local healthcheck_results_sorted_by_date=$(echo "$healthcheck_results" | sort -rg) # sort by last modified date
local healthcheck_results_sorted_by_date=$(echo "$healthcheck_results" | sort -t' ' -k1,1rn -k2) # sort by last modified date and URL
local healthy_mirrors_date=${healthcheck_results_sorted_by_date%% *} # the last modified date of healthy up-to-date mirrors
local healthy_mirrors=$(echo "$healthcheck_results_sorted_by_date" | grep "^$healthy_mirrors_date " | cut -d" " -f2-)
if [[ $verbosity -gt 0 ]]; then
Expand All @@ -321,7 +321,7 @@ function find_fast_mirror() {
0) >&2 echo " -> n/a $mirror_url" ;;
*) >&2 echo " -> outdated (last modified: $(date -d "@$last_modified" +'%Y-%m-%d %H:%M:%S %Z')) $mirror_url" ;;
esac
done <<< "$healthcheck_results"
done <<< "$healthcheck_results_sorted_by_date"
fi
>&2 echo " => $(echo "$healthy_mirrors" | wc -l) mirrors are reachable and up-to-date"

Expand Down

0 comments on commit 7f9fccf

Please sign in to comment.