fix: disconnect、commitを呼ぶ位置がおかしいので修正
This commit is contained in:
parent
acdedf13af
commit
5f508ad123
@ -98,11 +98,7 @@ def _import_to_ultmarc_table(dat_file: DatFile):
|
||||
log_message = ','.join([f'"{r}"' for r in record])
|
||||
logger.warning(f'ERROR_LINE: {log_message}')
|
||||
dat_file.count_up_error()
|
||||
# すべての行を登録終えたらコミットする
|
||||
db.commit()
|
||||
db.disconnect()
|
||||
# 処理結果をログに出力する
|
||||
logger.info('Transaction COMMIT')
|
||||
logger.info(f'ultmarc import process RESULT')
|
||||
logger.info(f'SUCCESS_COUNT={dat_file.success_count}')
|
||||
logger.info(f'ERROR_COUNT={dat_file.error_count}')
|
||||
@ -111,8 +107,8 @@ def _import_to_ultmarc_table(dat_file: DatFile):
|
||||
# 1件でもエラーがあれば、通知用にログに出力する
|
||||
if dat_file.error_count > 0:
|
||||
logger.warning('取り込みに失敗した行があります。詳細は`ERROR_LINE:`の行を確認してください。')
|
||||
except Exception as e:
|
||||
raise e
|
||||
finally:
|
||||
# 終了時に必ずコミットする
|
||||
db.commit()
|
||||
db.disconnect()
|
||||
return
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user