Set command timeout to lock timeout if higher tan default of 30s

This commit is contained in:
Sipke Schoorstra 2021-04-01 20:04:14 +02:00
parent 55c77454eb
commit b05861a2c0

View file

@ -47,6 +47,7 @@ namespace Elsa
command.Parameters.AddWithValue("@LockOwner", $"Session");
command.Parameters.AddWithValue("@LockMode", $"Exclusive");
command.Parameters.AddWithValue("@LockTimeout", timeoutMils);
command.CommandTimeout = Math.Max((int?)timeout?.TotalSeconds ?? 30, 30);
var returnParameter = command.Parameters.Add("RetVal", SqlDbType.Int);
returnParameter.Direction = ParameterDirection.ReturnValue;