NinjaScript > Language Reference > Strategy >

MaxRestartAttempts

Print this Topic Previous pageReturn to chapter overviewNext page

Definition

Indicates the maximum number of restart attempts allowed within the last x minutes defined in MaxRestartMinutes when the strategy experiences a connection loss. If restart attempts exceeds this property within a time span shorter than or equal to MaxRestartMinutes, then the strategy will be stopped and no further attempts will occur. The purpose of these settings is to stop the strategy should your connection be unstable and incapable of maintaining a consistent connected state.

 

Property Value

An int value represents the maximum number of restart attempts.

 

Syntax

MaxRestartAttempts

 

 

Examples

protected override void Initialize()
{

    // Only allow the strategy to restart 4 times within the MaxRestartMinutes time span

    // If disconnected more than 4 times within that time span, stop the strategy and do not attempt any further restarts.
    MaxRestartAttempts = 4;
}