Skip to content

Commit

Permalink
Adds exclusive mode debugging options
Browse files Browse the repository at this point in the history
  • Loading branch information
ryannewington committed Jan 9, 2017
1 parent 58eb863 commit 418be62
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/Lithnet.Miiserver.AutoSync.Setup/Components.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
<ComponentRef Id="EventSource"/>
<ComponentRef Id="cmpb05fc8933594449d9aad05ca620a4331"/>
<ComponentRef Id="cmpb79b2c604b1748aa9606e987e86aad3a"/>
<ComponentRef Id="cmp6a821b6b997b4f3086f29128770a5ca8"/>
</ComponentGroup>
</Fragment>
</Wix>
2 changes: 1 addition & 1 deletion src/Lithnet.Miiserver.AutoSync.Setup/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Product Id="*"
Name="Lithnet FIM/MIM AutoSync Service"
Language="1033"
Version="1.0.6156"
Version="1.0.6218"
Manufacturer="Lithnet"
UpgradeCode="028A57DF-28CE-47B0-9B3E-18B523A643D4">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64" />
Expand Down
25 changes: 24 additions & 1 deletion src/Lithnet.Miiserver.AutoSync/MAExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ private void Init()
try
{
this.ExecutingRunProfile = action.RunProfileName;

this.SetExclusiveMode(action);

if (this.IsSyncStepOrFimMADeltaImport(action.RunProfileName))
{
Expand All @@ -579,9 +581,25 @@ private void Init()
}
}

private void SetExclusiveMode(ExecutionParameters action)
{
// If the debug flags for running serial sync operations are set, then mark the operation as exclusive
if (Settings.RunAllExclusive)
{
action.Exclusive = true;
}
else if (Settings.RunSyncExclusive)
{
if (this.IsSyncStep(action.RunProfileName))
{
action.Exclusive = true;
}
}
}

private bool IsSyncStepOrFimMADeltaImport(string runProfileName)
{
if (this.ma.RunProfiles[runProfileName].RunSteps.Any(t => t.IsSyncStep))
if (this.IsSyncStep(runProfileName))
{
return true;
}
Expand All @@ -597,6 +615,11 @@ private bool IsSyncStepOrFimMADeltaImport(string runProfileName)
return false;
}

private bool IsSyncStep(string runProfileName)
{
return this.ma.RunProfiles[runProfileName].RunSteps.Any(t => t.IsSyncStep);
}

private void CheckAndQueueUnmanagedChanges()
{
this.localOperationLock.WaitOne();
Expand Down
6 changes: 6 additions & 0 deletions src/Lithnet.Miiserver.AutoSync/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ public static int MailServerPort
}
}


public static bool RunSyncExclusive => Settings.BaseKey.GetValue("ExclusiveSync") as string == "1";

public static bool RunAllExclusive => Settings.BaseKey.GetValue("ExclusiveAll") as string == "1";


public static bool MailSendOncePerStateChange => Settings.BaseKey.GetValue("MailSendOncePerStateChange") as string != "0";

public static bool RunHistorySave => Settings.BaseKey.GetValue("RunHistorySave") as string == "1";
Expand Down

0 comments on commit 418be62

Please sign in to comment.