43 lines
642 B
C#
43 lines
642 B
C#
namespace Questionable.Controller.Steps.Interactions;
|
|
|
|
internal sealed class DutyRetryState
|
|
{
|
|
private int _retryCount;
|
|
|
|
public bool AwaitingOutcome { get; private set; }
|
|
|
|
public bool CanRetry(int maxRetries)
|
|
{
|
|
if (maxRetries >= 0)
|
|
{
|
|
if (maxRetries == 0)
|
|
{
|
|
return false;
|
|
}
|
|
return _retryCount < maxRetries;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public void BeginAwaitingOutcome()
|
|
{
|
|
AwaitingOutcome = true;
|
|
}
|
|
|
|
public void EndAwaitingOutcome()
|
|
{
|
|
AwaitingOutcome = false;
|
|
}
|
|
|
|
public void RecordRetry()
|
|
{
|
|
_retryCount++;
|
|
AwaitingOutcome = false;
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
_retryCount = 0;
|
|
AwaitingOutcome = false;
|
|
}
|
|
}
|