Skip to content

Commit

Permalink
set loggin timeout to 1 day
Browse files Browse the repository at this point in the history
  • Loading branch information
JFriel committed Aug 8, 2024
1 parent 241dd2d commit 440eafd
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Rdmp.Core/Logging/TableLoadInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

using System;
using System.Data;
using System.Diagnostics;
using System.Threading;
using FAnsi.Connections;
using FAnsi.Discovery;
Expand Down Expand Up @@ -179,6 +180,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 @@ -194,8 +196,17 @@ public void CloseAndArchive()
DatabaseSettings.AddParameterWithValueToCommand("@notes", cmdCloseRecord,
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 440eafd

Please sign in to comment.