Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the hard upper limit for SQL write lock timeout #18260

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading