-
Notifications
You must be signed in to change notification settings - Fork 336
Make all communication timeouts configurable. #1538
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 6 commits
9f6651a
75580ea
defe218
119e272
e5cbb02
83703fb
bbf787b
da303f6
7389af1
be20f85
daf85b1
018cbaa
6bf095c
c85b80b
4244707
e0ef0d1
91d5c45
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Microsoft.VisualStudio.TestPlatform.CoreUtilities.Helpers | ||
{ | ||
using System; | ||
using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; | ||
using ObjectModel; | ||
|
||
public class EnvironmentHelper | ||
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 is an IEnvironment Interface in platform abstractions, should it not move there? 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. We will go for PlatformAbstration if there is need to do #if defs. This function not required that. |
||
{ | ||
public const string VstestConnectionTimeout = "VSTEST_CONNECTION_TIMEOUT"; | ||
public const int DefaultConnectionTimeout = 90; // seconds | ||
|
||
/// <summary> | ||
/// Get timeout based on environment variable VSTEST_CONNECTION_TIMEOUT. | ||
/// </summary> | ||
public static int GetConnectionTimeout() | ||
{ | ||
var envVarValue = Environment.GetEnvironmentVariable(EnvironmentHelper.VstestConnectionTimeout); | ||
if (!string.IsNullOrEmpty(envVarValue) && int.TryParse(envVarValue, out int value)) | ||
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. if user sets a very small value say 10, should we honor it? I would say we keep 90 or 60 something as min, & users value will only be honored if it is > min val 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. Handled -ve case. Keep min value 0, giving more choice to user. |
||
{ | ||
EqtTrace.Info("EnvironmentHelper.GetConnectionTimeout: {0} value set to {1}.", EnvironmentHelper.VstestConnectionTimeout, value); | ||
} | ||
else | ||
{ | ||
value = EnvironmentHelper.DefaultConnectionTimeout; | ||
} | ||
|
||
return value; | ||
} | ||
} | ||
} |
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.
do we want to add more in CoreUtilities dll? can we move this to Testplatform.Utilities?
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.
CoreUtilities have basic utilities on BCL. TestPlatform.Utilities has OM + BCL Utilities.