added procedure to update data source last seen datetime in myems-bacnet service

pull/40/head
13621160019@163.com 2021-04-28 18:15:18 +08:00
parent 34d2639d0d
commit 16734a220b
1 changed files with 2 additions and 2 deletions

View File

@ -510,14 +510,14 @@ def process(logger, ):
if len(last_seen_data_source_set) > 0: if len(last_seen_data_source_set) > 0:
update_row = (" UPDATE tbl_data_sources " update_row = (" UPDATE tbl_data_sources "
" SET last_seen_datetime_utc = %s " " SET last_seen_datetime_utc = '" + current_datetime_utc.isoformat() + "' "
" WHERE id IN (") " WHERE id IN (")
for data_source_id in last_seen_data_source_set: for data_source_id in last_seen_data_source_set:
update_row += str(data_source_id) + "," update_row += str(data_source_id) + ","
try: try:
cursor_system_db.execute(update_row[:-1] + ")", (current_datetime_utc.isoformat(),)) cursor_system_db.execute(update_row[:-1] + ")",)
cnx_system_db.commit() cnx_system_db.commit()
except Exception as e: except Exception as e:
logger.error("Error in step 4.4.4 of acquisition process " + str(e)) logger.error("Error in step 4.4.4 of acquisition process " + str(e))