Skip to content

Commit

Permalink
Fixes issue #130 - Canceling an unmanaged run does not work
Browse files Browse the repository at this point in the history
Fixes issue #129 - The controller encountered an unrecoverable error
Adds feature #127 - Ability to enable/disable triggers
Adds feature #132 - Adds support for new locking modes
Adds feature #131 - Add ability for time-based triggers to put their tasks to the front of the execution queue
  • Loading branch information
ryannewington committed Jan 21, 2018
1 parent 3de4c97 commit 56c0f32
Show file tree
Hide file tree
Showing 24 changed files with 554 additions and 112 deletions.
2 changes: 1 addition & 1 deletion src/Lithnet.Miiserver.AutoSync.Setup/Components.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

<util:PerformanceCategory Id="PerformanceCounter" Name="Lithnet AutoSync" MultiInstance="yes" DefaultLanguage="english">
<util:PerformanceCounter Name="Queue length" Type="numberOfItems64" Help="Shows the current number of jobs in the execution queue"/>
<util:PerformanceCounter Name="Total run count" Type="numberOfItems64" Help="Shows the total number of jobs executed"/>
<util:PerformanceCounter Name="Runs/10 min" Type="numberOfItems64" Help="Shows the total number of jobs executed"/>

<util:PerformanceCounter Name="Wait time % - sync lock" Type="numberOfItems64" />
<util:PerformanceCounter Name="Wait time % - exclusive lock" Type="numberOfItems64" />
Expand Down
15 changes: 14 additions & 1 deletion src/Lithnet.Miiserver.AutoSync/Config/RegistrySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public static TimeSpan ExecutionStaggerInterval
}
else
{
return TimeSpan.FromSeconds(2);
return TimeSpan.FromSeconds(1);
}
}
}
Expand All @@ -238,6 +238,19 @@ public static TimeSpan ExclusiveModeDeferralInterval
}
}

public static int LockMode
{
get
{
// LockMode = 0 : FIFO locking
// LockMode = 1 : Exclusive jobs yield to any non-exclusive job that was in the queue at the time the exclusive job took the x-lock
// LockMode = 2 : Exclusive jobs yield to all non-exclusive jobs

return (int)RegistrySettings.ParametersKey.GetValue(nameof(LockMode), 0);
}
}


public static TimeSpan PostRunInterval
{
get
Expand Down
26 changes: 19 additions & 7 deletions src/Lithnet.Miiserver.AutoSync/EventArgs/ExecutionParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,68 @@ public class ExecutionParameters
{
public bool Exclusive { get; set; }

public bool RunImmediate { get; set; }

public string RunProfileName { get; set; }

public MARunProfileType RunProfileType { get; set; }

public Guid PartitionID { get; set; }

public long QueueID { get; set; }

public string PartitionName { get; set; }

public ExecutionParameters()
{
}

public ExecutionParameters(string runProfileName)
: this(runProfileName, false)
: this(runProfileName, false, false)
{
}

public ExecutionParameters(string runProfileName, bool exclusive)
: this(runProfileName, exclusive, false)
{
}

public ExecutionParameters(string runProfileName, bool exclusive, bool runImmediate)
{
this.RunProfileName = runProfileName;
this.Exclusive = exclusive;
this.RunImmediate = runImmediate;
}

public ExecutionParameters(MARunProfileType runProfileType)
: this(runProfileType, null, false)
: this(runProfileType, null, false, false)
{
}

public ExecutionParameters(MARunProfileType runProfileType, Guid partitionID)
: this(runProfileType, partitionID, false)
: this(runProfileType, partitionID, false, false)
{
}

public ExecutionParameters(MARunProfileType runProfileType, bool exclusive)
: this(runProfileType, null, exclusive)
public ExecutionParameters(MARunProfileType runProfileType, bool exclusive, bool runImmediate)
: this(runProfileType, null, exclusive, runImmediate)
{
}

public ExecutionParameters(MARunProfileType runProfileType, Guid partitionID, bool exclusive)
public ExecutionParameters(MARunProfileType runProfileType, Guid partitionID, bool exclusive, bool runImmediate)
{
this.RunProfileType = runProfileType;
this.PartitionID = partitionID;
this.Exclusive = exclusive;
this.RunImmediate = runImmediate;
}

public ExecutionParameters(MARunProfileType runProfileType, string partitionName, bool exclusive)
public ExecutionParameters(MARunProfileType runProfileType, string partitionName, bool exclusive, bool runImmediate)
{
this.RunProfileType = runProfileType;
this.PartitionName = partitionName;
this.Exclusive = exclusive;
this.RunImmediate = runImmediate;
}

public override bool Equals(object obj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public ExecutionTriggerEventArgs(MARunProfileType runProfileType, Guid partition

public ExecutionTriggerEventArgs(MARunProfileType runProfileType, string partitionName)
{
this.Parameters = new ExecutionParameters(runProfileType, partitionName, false);
this.Parameters = new ExecutionParameters(runProfileType, partitionName, false, false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>TRACE;DEBUG;LOCKDEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
Expand Down
Loading

0 comments on commit 56c0f32

Please sign in to comment.