Added Command Timeout to each query that did not have a specified timeout

Added SQLTimeout Property (Default 30 Seconds) which is 1/20 of the DefaultTimeout (Default 600 seconds)
This commit is contained in:
Rich 2017-03-01 15:41:15 +00:00
parent aa40ff017d
commit b5f4a0751e

View File

@ -98,13 +98,15 @@ public static string DBServer
}
}
private static int _DefaultTimeout = 600; // 600 seconds, i.e. 10 minutes
public static int DefaultTimeout
{
get { return _DefaultTimeout; }
set { _DefaultTimeout = value; }
}
public static int SQLTimeout
{
get { return _DefaultTimeout/20; }
}
public static void LogException(string s, Exception ex)
{
int i = 0;
@ -541,6 +543,7 @@ public static string DBServer
using (SqlCommand cmd = new SqlCommand("vesp_CanTransitionBeCreated", cn))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandTimeout = Database.SQLTimeout;
cmd.Parameters.AddWithValue("fromItemID", _FromID);
cmd.Parameters.AddWithValue("toItemID", _ToID);
using (SafeDataReader dr = new SafeDataReader(cmd.ExecuteReader()))
@ -630,6 +633,7 @@ public static string DBServer
using (SqlCommand cmd = new SqlCommand("vesp_WillTransitionsBeValid", cn))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandTimeout = Database.SQLTimeout;
cmd.Parameters.AddWithValue("ItemID", _ItemID);
cmd.Parameters.AddWithValue("NewAppl", _NewAppl);
using (SafeDataReader dr = new SafeDataReader(cmd.ExecuteReader()))