mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-19 09:35:36 -05:00
Move unused forked code to external directory (#1192)
* Move unused forked code to external directory * Fix SLN build errors * Add back resource provider core since it's referenced by main resource provider project * Update PackageProjects step of pipeline
This commit is contained in:
86
external/Microsoft.SqlTools.CoreServices/Connection/ReliableConnection/RetryState.cs
vendored
Normal file
86
external/Microsoft.SqlTools.CoreServices/Connection/ReliableConnection/RetryState.cs
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.SqlTools.CoreServices.Connection.ReliableConnection
|
||||
{
|
||||
internal class RetryState
|
||||
{
|
||||
private int _retryCount = 0;
|
||||
private TimeSpan _delay = TimeSpan.Zero;
|
||||
private Exception _lastError = null;
|
||||
private bool _isDelayDisabled = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current retry attempt count.
|
||||
/// </summary>
|
||||
public int RetryCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return _retryCount;
|
||||
}
|
||||
set
|
||||
{
|
||||
_retryCount = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the delay indicating how long the current thread will be suspended for before the next iteration will be invoked.
|
||||
/// </summary>
|
||||
public TimeSpan Delay
|
||||
{
|
||||
get
|
||||
{
|
||||
return _delay;
|
||||
}
|
||||
set
|
||||
{
|
||||
_delay = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the exception which caused the retry conditions to occur.
|
||||
/// </summary>
|
||||
public Exception LastError
|
||||
{
|
||||
get
|
||||
{
|
||||
return _lastError;
|
||||
}
|
||||
set
|
||||
{
|
||||
_lastError = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether we should ignore delay in order to be able to execute our tests faster
|
||||
/// </summary>
|
||||
/// <remarks>Intended for test use ONLY</remarks>
|
||||
internal bool IsDelayDisabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isDelayDisabled;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isDelayDisabled = value;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Reset()
|
||||
{
|
||||
this.IsDelayDisabled = false;
|
||||
this.RetryCount = 0;
|
||||
this.Delay = TimeSpan.Zero;
|
||||
this.LastError = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user