Improve efficiency of gathering drive storage info

This commit is contained in:
Taylor Helsper 2024-06-05 00:28:05 -05:00
parent de5fd4ff19
commit be0702c852

View File

@ -58,8 +58,12 @@ def update_device_info():
cpu_info = psutil.cpu_times_percent(interval=5.0, percpu=False) cpu_info = psutil.cpu_times_percent(interval=5.0, percpu=False)
cpu_usage = "{:.1f}%".format(100.0 - cpu_info.idle) cpu_usage = "{:.1f}%".format(100.0 - cpu_info.idle)
# Update every 24 hrs (start at ~5 min) # Update every 3 days (72 hrs) (start at ~15 min)
if device_info_call_count % (60*24) == 5: if device_info_call_count % (60*24*3) == 15:
if not os.path.isfile(BITCOIN_SYNCED_FILE):
os_drive_usage_details = "<small>Waiting on Bitcoin sync...</small>"
data_drive_usage_details = "<small>Waiting on Bitcoin sync...</small>"
else:
os_drive_usage_details = "" os_drive_usage_details = ""
os_drive_usage_details += "<small>" os_drive_usage_details += "<small>"
os_drive_usage_details += "<b>App Storage</b><br/>" os_drive_usage_details += "<b>App Storage</b><br/>"
@ -102,7 +106,7 @@ def update_bitcoin_main_info_thread():
bitcoin_block_height = get_bitcoin_block_height() bitcoin_block_height = get_bitcoin_block_height()
mynode_block_height = get_mynode_block_height() mynode_block_height = get_mynode_block_height()
remaining = bitcoin_block_height - mynode_block_height remaining = bitcoin_block_height - mynode_block_height
if remaining == 0 and bitcoin_block_height > 820000: if remaining == 0 and bitcoin_block_height > 845000:
synced = True synced = True
if not os.path.isfile(BITCOIN_SYNCED_FILE): if not os.path.isfile(BITCOIN_SYNCED_FILE):
open(BITCOIN_SYNCED_FILE, 'a').close() # touch file open(BITCOIN_SYNCED_FILE, 'a').close() # touch file