-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CSHARP-3549: CSOT: Add timeoutMS to settings #1721
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* Copyright 2013-present MongoDB Inc. | ||
/* Copyright 2010-present MongoDB Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
|
@@ -444,11 +444,12 @@ public static string IsNullOrNotEmpty(string value, string paramName) | |
/// <returns>The value of the parameter.</returns> | ||
public static TimeSpan? IsNullOrValidTimeout(TimeSpan? value, string paramName) | ||
{ | ||
if (value != null) | ||
if (value == null) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was probably no need to touch this file at all. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't mind leaving these changes in. I think they improve this code a bit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe not... In general I don't like making random changes to files that have nothing to do with the PR. If we think these methods could be written in a better way we should make a ticket for it. The reason that all methods end with
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same story here as with previous change in the file: some how "quick returns" works better for me to understand the code. But I do not mind to revert the code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anyhow: reverted 🙂 |
||
{ | ||
IsValidTimeout(value.Value, paramName); | ||
return null; | ||
} | ||
return value; | ||
|
||
return IsValidTimeout(value.Value, paramName); | ||
} | ||
|
||
/// <summary> | ||
|
@@ -459,12 +460,12 @@ public static string IsNullOrNotEmpty(string value, string paramName) | |
/// <returns>The value of the parameter.</returns> | ||
public static TimeSpan IsValidTimeout(TimeSpan value, string paramName) | ||
{ | ||
if (value < TimeSpan.Zero && value != Timeout.InfiniteTimeSpan) | ||
if (value > TimeSpan.Zero || value == Timeout.InfiniteTimeSpan) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you flip the logic in this method? All the other methods end with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Somehow this way it's easier to understand for me. But not critical, will revert to follow other methods pattern. |
||
{ | ||
var message = string.Format("Invalid timeout: {0}.", value); | ||
throw new ArgumentException(message, paramName); | ||
return value; | ||
} | ||
return value; | ||
|
||
throw new ArgumentOutOfRangeException($"Invalid timeout: {value}.", paramName); | ||
} | ||
|
||
/// <summary> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this file/class be called
IClientSessionExtensions
?