database caller crash fix

This commit is contained in:
Neythen Treloar 2022-03-01 18:27:45 +00:00
parent 36b4877d2c
commit d891e5ef6d
2 changed files with 23 additions and 4 deletions

View File

@ -552,10 +552,15 @@ def checkStocks(last_update, update_frequency):
def updateAll(api_key, weather_key):
updateStocks(api_key)
updateCrypto(api_key)
updateForex(api_key)
updateNews(api_key)
updateSports(api_key)
if weather_key:
updateWeather(weather_key)
@ -626,8 +631,20 @@ if __name__ == '__main__':
msg = getInput()
if msg == 'A':
updateAll(api_key, weather_key)
update_process = Process(target = updateAll, args = (api_key,weather_key))
update_process.start()
update_processes.append(update_process)
stock_time = NY_time.strftime("%d/%m/%Y %H:%M:%S")
last_updates['stocks'] = stock_time
last_updates['crypto'] = stock_time
last_updates['weather'] = stock_time
last_updates['news'] = stock_time
last_updates['sports'] = stock_time
CET_time = datetime.now(CET_zone)
forex_time = CET_time.strftime("%d/%m/%Y %H:%M:%S")
last_updates['forex'] = forex_time
NY_time = datetime.now(NY_zone).replace(tzinfo=None)
#stocks
stock_time = datetime.strptime(last_updates['stocks'], "%d/%m/%Y %H:%M:%S")
stock_frequency = update_frequencies['stocks']

View File

@ -29,12 +29,14 @@ import sys
#api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 api_caller.py")
api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 database_caller.py")
api_caller = pexpect.spawn("sudo -E python3 database_caller.py")
time.sleep(3)
api_caller.sendline('A')
os.system("sudo ./check_update.sh")
#os.system("sudo ./check_update.sh")
displaying_screensaver = False
uploading = False