Skip to content

Commit

Permalink
Remove the hard upper limit for SQL write lock timeout (#18260)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjac authored Feb 7, 2025
1 parent 460c0b3 commit 62f4666
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,14 @@ private bool ValidateSmtpSetting(SmtpSettings? value, out string message) =>

private bool ValidateSqlWriteLockTimeOutSetting(TimeSpan configuredTimeOut, out string message)
{
// Only apply this setting if it's not excessively high or low
// Only apply this setting if it's not excessively low
const int minimumTimeOut = 100;
const int maximumTimeOut = 20000;

// between 0.1 and 20 seconds
if (configuredTimeOut.TotalMilliseconds < minimumTimeOut ||
configuredTimeOut.TotalMilliseconds > maximumTimeOut)
if (configuredTimeOut.TotalMilliseconds < minimumTimeOut)
{
message =
$"The `{Constants.Configuration.ConfigGlobal}:{nameof(GlobalSettings.DistributedLockingWriteLockDefaultTimeout)}` setting is not between the minimum of {minimumTimeOut} ms and maximum of {maximumTimeOut} ms";
$"The `{Constants.Configuration.ConfigGlobal}:{nameof(GlobalSettings.DistributedLockingWriteLockDefaultTimeout)}` should not be configured as less than {minimumTimeOut} ms";
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@ public void Returns_Fail_For_Configuration_With_Insufficient_SqlWriteLockTimeOut
Assert.False(result.Succeeded);
}

[Test]
public void Returns_Fail_For_Configuration_With_Excessive_SqlWriteLockTimeOut()
{
var validator = new GlobalSettingsValidator();
var options = new GlobalSettings { DistributedLockingWriteLockDefaultTimeout = TimeSpan.Parse("00:00:21") };

var result = validator.Validate("settings", options);
Assert.False(result.Succeeded);
}

[Test]
public void Returns_Success_For_Configuration_With_Valid_SqlWriteLockTimeOut()
{
Expand Down

0 comments on commit 62f4666

Please sign in to comment.