Skip to content

Commit

Permalink
add updated timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
JFriel committed Aug 8, 2024
1 parent 9a5636a commit ca932a1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Rdmp.Core/Logging/TableLoadInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using FAnsi.Connections;
using FAnsi.Discovery;
using Rdmp.Core.ReusableLibraryCode.Settings;
using System.Diagnostics;

namespace Rdmp.Core.Logging;

Expand Down Expand Up @@ -182,6 +183,7 @@ public string Notes

public void CloseAndArchive()
{
DatabaseSettings.Builder.Add("Command Timeout", 86400);//wait up to 1 day to perform the command
using var con = DatabaseSettings.BeginNewTransactedConnection();
using var cmdCloseRecord = DatabaseSettings.GetCommand(
"UPDATE TableLoadRun SET endTime=@endTime,inserts=@inserts,updates=@updates,deletes=@deletes,errorRows=@errorRows,duplicates=@duplicates, notes=@notes WHERE ID=@ID",
Expand All @@ -198,7 +200,18 @@ public void CloseAndArchive()
string.IsNullOrWhiteSpace(Notes) ? DBNull.Value : Notes);
DatabaseSettings.AddParameterWithValueToCommand("@ID", cmdCloseRecord, ID);

var affectedRows = cmdCloseRecord.ExecuteNonQuery();
int affectedRows = 0;
var timer = Stopwatch.StartNew();
try
{
affectedRows = cmdCloseRecord.ExecuteNonQuery();
}
catch (Exception e)
{
timer.Stop();
throw new Exception($"Guneet Logging Test: Waited - {timer.ElapsedMilliseconds}ms.{e.Message}");
}
timer.Stop();

if (affectedRows != 1)
throw new Exception(
Expand Down

0 comments on commit ca932a1

Please sign in to comment.