Skip to content

Commit

Permalink
Adds workaround for sync engine lock ups by processing FIM MA DIs in …
Browse files Browse the repository at this point in the history
…the sync step queue

Fixes an issue where a run profile may be added to a queue multiple times
  • Loading branch information
ryannewington committed Jul 21, 2016
1 parent bbe8616 commit 20a14b1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
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.6038"
Version="1.0.6046"
Manufacturer="Lithnet"
UpgradeCode="028A57DF-28CE-47B0-9B3E-18B523A643D4">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64" />
Expand Down
23 changes: 17 additions & 6 deletions src/Lithnet.Miiserver.AutoSync/EventArgs/ExecutionParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Lithnet.Miiserver.AutoSync
{
public class ExecutionParameters
{
public bool Exclusive { get; set; }
public bool Exclusive { get; set; }

public string RunProfileName { get; set; }

Expand All @@ -25,13 +25,13 @@ public ExecutionParameters(MARunProfileType runProfileType)
}

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

public ExecutionParameters(MARunProfileType runProfileType, bool exclusive)
:this(runProfileType)
: this(runProfileType)
{
this.Exclusive = exclusive;
}
Expand All @@ -45,9 +45,20 @@ public override bool Equals(object obj)
return object.ReferenceEquals(this, obj);
}

return (string.Equals(this.RunProfileName, p2.RunProfileName, StringComparison.OrdinalIgnoreCase) &&
this.RunProfileType == p2.RunProfileType &&
this.Exclusive == p2.Exclusive);
if (!string.IsNullOrWhiteSpace(this.RunProfileName))
{
if (string.Equals(this.RunProfileName, p2.RunProfileName, StringComparison.OrdinalIgnoreCase) && this.Exclusive == p2.Exclusive)
{
return true;
}
}

if (this.RunProfileType == p2.RunProfileType && this.Exclusive == p2.Exclusive)
{
return true;
}

return false;
}

public override int GetHashCode()
Expand Down
20 changes: 19 additions & 1 deletion src/Lithnet.Miiserver.AutoSync/MAExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ private void Init()
{
this.ExecutingRunProfile = action.RunProfileName;

if (this.ma.RunProfiles[action.RunProfileName].RunSteps.Any(t => t.IsSyncStep))
if (this.IsSyncStepOrFIMMADeltaImport(action.RunProfileName))
{
lock (MAExecutor.GlobalSynchronizationStepLock)
{
Expand All @@ -577,6 +577,24 @@ private void Init()
}
}

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

if (this.ma.Category == "FIM")
{
if (this.ma.RunProfiles[runProfileName].RunSteps.Any(t => t.Type == RunStepType.DeltaImport))
{
return true;
}
}

return false;
}

private void CheckAndQueueUnmanagedChanges()
{
this.localOperationLock.WaitOne();
Expand Down

0 comments on commit 20a14b1

Please sign in to comment.