From 90c1a5409f53d4f729ac2c2ff2a82fa06fdf52c6 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 14 Jul 2021 12:07:25 +0200 Subject: [PATCH] Jobs: Close connection for Update_HistoryEntry as well --- Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb b/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb index b8797d48..d0ae040c 100644 --- a/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb +++ b/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb @@ -655,7 +655,7 @@ Public Class ImportZUGFeRDFiles Dim oSQL = $"INSERT INTO TBEDM_ZUGFERD_HISTORY_IN (COMMENT, MD5HASH, MESSAGE_ID) VALUES ('{Message}', '{MD5Checksum}', '{MessageId}')" ' 09.07.2021: This can't be in the transaction since the history - ' entry needs to be accessed by MoveAndRenameEmailToRejected shortly after + ' Entry needs to be accessed by MoveAndRenameEmailToRejected shortly after _firebird.ExecuteNonQueryWithConnection(oSQL, oConnection, Firebird.TransactionMode.WithTransaction) ' Close the connection @@ -674,8 +674,12 @@ Public Class ImportZUGFeRDFiles Try Dim oConnection = _firebird.GetConnection() Dim oSQL = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET COMMENT = '{Message}' WHERE MD5HASH = '{MD5Checksum}' AND MESSAGE_ID = '{MessageId}'" + _firebird.ExecuteNonQueryWithConnection(oSQL, oConnection, Firebird.TransactionMode.WithTransaction) + ' Close the connection + oConnection.Close() + Return True Catch ex As Exception _logger.Warn("History Entry count not be updated for message id [{0}] and md5 [{1}]", MessageId, MD5Checksum)