Skip to content

Commit

Permalink
Merge pull request #209 from Omegagoth/patch-1
Browse files Browse the repository at this point in the history
Resolve the issue on Alpine
  • Loading branch information
jotyGill authored Oct 28, 2018
2 parents bd993a0 + 7264209 commit 23e76a0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions openpyn/openpyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ def ping_servers(better_servers_list: List, pings: str, stats: bool) -> List:
stdout=subprocess.PIPE)
# pipe the output of ping to grep.
ping_output = subprocess.check_output(
["grep", "-B", "1", "min/avg/max/"], stdin=ping_proc.stdout)
["grep", "-B", "1", "min/avg/max"], stdin=ping_proc.stdout)

ping_string = str(ping_output)
# logger.debug(ping_string)
Expand All @@ -557,8 +557,12 @@ def ping_servers(better_servers_list: List, pings: str, stats: bool) -> List:
ping_result.append(ping_list)
# logger.debug(ping_result)
pinged_servers_list.append(ping_result)
# sort by Ping Avg and Median Deviation
pinged_servers_list = sorted(pinged_servers_list, key=lambda item: (item[1][1], item[1][3]))
if len(pinged_servers_list[0][1]) >= 4:
# sort by Ping Avg and Median Deviation
pinged_servers_list = sorted(pinged_servers_list, key=lambda item: (item[1][1], item[1][3]))
else:
# sort by Ping Avg
pinged_servers_list = sorted(pinged_servers_list, key=lambda item: item[1][1])
return pinged_servers_list


Expand Down

0 comments on commit 23e76a0

Please sign in to comment.