mirror of
https://gitlab.com/kernel-firmware/linux-firmware.git
synced 2025-12-10 07:44:48 +01:00
trivial: contrib: wrap the process in try/except to catch server issues
If lore has load problems, don't bail, just wrap them and try again on the next cycle. Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
This commit is contained in:
parent
3d2c53f21f
commit
84e4027f90
1 changed files with 11 additions and 7 deletions
|
|
@ -376,19 +376,23 @@ if __name__ == "__main__":
|
|||
logging.getLogger("").addHandler(console)
|
||||
|
||||
while True:
|
||||
conn = sqlite3.connect(args.database)
|
||||
# update the database
|
||||
update_database(conn, args.url)
|
||||
|
||||
if args.dry:
|
||||
remote = ""
|
||||
else:
|
||||
remote = args.remote
|
||||
|
||||
# process the database
|
||||
process_database(conn, remote)
|
||||
try:
|
||||
conn = sqlite3.connect(args.database)
|
||||
|
||||
conn.close()
|
||||
# update the database
|
||||
update_database(conn, args.url)
|
||||
# process the database
|
||||
process_database(conn, remote)
|
||||
|
||||
except urllib.error.HTTPError as e:
|
||||
logging.error("Failed to fetch URL: {}".format(e))
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
if args.refresh_cycle:
|
||||
logging.info("Sleeping for {} minutes".format(args.refresh_cycle))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue