-
Notifications
You must be signed in to change notification settings - Fork 354
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 5 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,26 @@ | ||
| // 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; | ||
|
|
||
| public class EnvironmentHelper | ||
|
Contributor
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?
Contributor
Author
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. |
||
| { | ||
| /// <summary> | ||
| /// Caluclate timeout based on environment and default value. | ||
| /// </summary> | ||
| /// <param name="environment">IEnvironment implementation. </param> | ||
| /// <param name="envVar"> Environment variable. </param> | ||
| /// <param name="defaultValue"> Default value in seconds. </param> | ||
| /// <returns cref="int"> Return value in milliseconds. </returns> | ||
| public static int GetConnectionTimeout(IEnvironment environment, string envVar, int defaultValue) | ||
| { | ||
| var increaseTimeoutByTimes = 1.0; | ||
| environment.GetEnviromentVariable(envVar, ref increaseTimeoutByTimes); | ||
| var timeout = increaseTimeoutByTimes * defaultValue * 1000; | ||
| return Convert.ToInt32(Math.Round(timeout)); | ||
| } | ||
| } | ||
| } | ||
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.