Unverified Commit 4eee20d4 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

log mariadb commit errors explicitly

parent 8cbc9c67
......@@ -318,18 +318,36 @@ class MediametadataToDB:
"digitalObject is unavailable")
if record_number % 100 == 0:
_write_values_in_db(mariadb_cursor, record_values_for_db)
mariadb_connection.commit()
for record_value in record_values_for_db:
logging.info(f'Record {record_value["sig"]} successfully indexed')
reporter.send_message(record_value['sig'], "SUCCESS",
"Indexing successful")
try:
mariadb_connection.commit()
for record_value in record_values_for_db:
logging.info(f'Record {record_value["sig"]} successfully indexed')
reporter.send_message(record_value['sig'], "SUCCESS",
"Indexing successful")
except mariadb.Error as error:
logging.error(error)
for record_value in record_values_for_db:
logging.info(f'Indexing of record {record_value["sig"]} failed')
reporter.send_message(record_value['sig'], "FATAL",
"Indexing failed")
record_values_for_db = []
consumer.commit()
if counter % 1000 == 0:
logging.info('{} messages read till now'.format(counter))
# arriving here means there are no new messages to poll from
_write_values_in_db(mariadb_cursor, record_values_for_db)
mariadb_connection.commit()
try:
mariadb_connection.commit()
for record_value in record_values_for_db:
logging.info(f'Record {record_value["sig"]} successfully indexed')
reporter.send_message(record_value['sig'], "SUCCESS",
"Indexing successful")
except mariadb.Error as error:
logging.error(error)
for record_value in record_values_for_db:
logging.info(f'Indexing of record {record_value["sig"]} failed')
reporter.send_message(record_value['sig'], "FATAL",
"Indexing failed")
for record_value in record_values_for_db:
reporter.send_message(record_value['sig'], "SUCCESS", "Indexing successful")
record_values_for_db = []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment