Modules.Jobs: Manchmal geht die DB-Connection verloren. Dann darf aber die Datei auch nicht verschoben werden, die gerade bearbeitet wurde.

This commit is contained in:
2024-06-28 11:40:12 +02:00
parent 30a6356565
commit 5a9a30d6f1

View File

@@ -370,6 +370,10 @@ Public Class ImportZUGFeRDFiles
_logger.Warn("Unknown Error occurred: {0}", ex.Message) _logger.Warn("Unknown Error occurred: {0}", ex.Message)
_logger.Error(ex) _logger.Error(ex)
oMoveDirectory = DIRECTORY_DONT_MOVE
oExpectedError = False
If oSQLConnection IsNot Nothing And oSQLTransaction IsNot Nothing Then
' Send Email to Digital Data ' Send Email to Digital Data
Dim oBody = _email.CreateBodyForUnhandledException(oMessageId, ex) Dim oBody = _email.CreateBodyForUnhandledException(oMessageId, ex)
Dim oEmailData As New EmailData With { Dim oEmailData As New EmailData With {
@@ -380,10 +384,7 @@ Public Class ImportZUGFeRDFiles
' Rollback Transaction ' Rollback Transaction
oSQLTransaction.Rollback() oSQLTransaction.Rollback()
End If
oMoveDirectory = DIRECTORY_DONT_MOVE
oExpectedError = False
Finally Finally
Try Try
@@ -414,16 +415,20 @@ Public Class ImportZUGFeRDFiles
' finally commit all changes To the Database ' finally commit all changes To the Database
' ================================================================== ' ==================================================================
If oIsSuccess Or oExpectedError Then If oIsSuccess Or oExpectedError Then
If oSQLTransaction IsNot Nothing Then
' Commit Transaction ' Commit Transaction
oSQLTransaction.Commit() oSQLTransaction.Commit()
End If End If
End If
Catch ex As Exception Catch ex As Exception
_logger.Error(ex) _logger.Error(ex)
_logger.Warn("Database Transactions were not committed successfully.") _logger.Warn("Database Transactions were not committed successfully.")
End Try End Try
Try Try
If oSQLConnection IsNot Nothing Then
oSQLConnection.Close() oSQLConnection.Close()
End If
Catch ex As Exception Catch ex As Exception
_logger.Error(ex) _logger.Error(ex)
_logger.Warn("Database Connections were not closed successfully.") _logger.Warn("Database Connections were not closed successfully.")