Update speedtester.py
parent
d8b5235502
commit
e05f7ff029
|
|
@ -126,6 +126,7 @@ downloading = True # True for download, False for upload
|
|||
threads = None
|
||||
servers = []
|
||||
|
||||
|
||||
def reset_globals():
|
||||
global wan_upload
|
||||
global wan_download
|
||||
|
|
@ -141,6 +142,7 @@ def reset_globals():
|
|||
speedtest_failed = False
|
||||
downloading = True
|
||||
|
||||
|
||||
def threaded_speedtest():
|
||||
global test_started
|
||||
global downloading
|
||||
|
|
@ -157,7 +159,6 @@ def threaded_speedtest():
|
|||
downloading = False
|
||||
s.upload(threads=threads, pre_allocate=False)
|
||||
|
||||
|
||||
results_dict = s.results.dict()
|
||||
log.info(
|
||||
f"Speedtest.net result: DOWN {mbits(results_dict['download'])} mbps; UP {mbits(results_dict['upload'])} mbps;")
|
||||
|
|
@ -220,13 +221,12 @@ def test_speed():
|
|||
sws.join()
|
||||
if wan_download >= config['ros_doublecheck_speed']:
|
||||
break
|
||||
else:
|
||||
elif i < tries - 1:
|
||||
log.warning("Speed is below ros_doublecheck_speed limit, retrying in a few seconds.")
|
||||
time.sleep(10)
|
||||
return
|
||||
|
||||
|
||||
|
||||
def generate_database_reports():
|
||||
dates, downloads, uploads = gather_data()
|
||||
|
||||
|
|
@ -234,12 +234,12 @@ def generate_database_reports():
|
|||
|
||||
generate_plot_image(dates, downloads, uploads)
|
||||
|
||||
|
||||
import sys
|
||||
from netutils import test_intertnet_connection
|
||||
|
||||
|
||||
def on_fail_or_no_connection():
|
||||
|
||||
ros_fastrack_enable(False)
|
||||
|
||||
entry = Entry()
|
||||
|
|
@ -252,6 +252,7 @@ def on_fail_or_no_connection():
|
|||
log.warning("No internet connection! Exiting.")
|
||||
sys.exit()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
'''
|
||||
This script will run a few speed tests, calculate average upload and download speeds and record them into database.
|
||||
|
|
@ -268,8 +269,6 @@ if __name__ == "__main__":
|
|||
# if not test_intertnet_connection():
|
||||
# no_internet()
|
||||
|
||||
|
||||
|
||||
if config["ros_dynamic_speed"]:
|
||||
ros_fastrack_enable(True)
|
||||
time.sleep(5)
|
||||
|
|
|
|||
Loading…
Reference in New Issue