Skip to content

Commit

Permalink
Fixes an issue where partial results from AD can build up causing hig…
Browse files Browse the repository at this point in the history
…h memory usage until GC runs

Fixes an issue where search results are not released
  • Loading branch information
ryannewington committed May 29, 2016
1 parent 917cef5 commit c652db8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 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.5990"
Version="1.0.5992"
Manufacturer="Lithnet"
UpgradeCode="028A57DF-28CE-47B0-9B3E-18B523A643D4">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64" />
Expand Down
12 changes: 8 additions & 4 deletions src/Lithnet.Miiserver.AutoSync/MAExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,10 @@ private void Execute(ExecutionParameters e)
Logger.WriteLine("{0}: {1} returned {2}", this.ma.Name, e.RunProfileName, ex.Result);
}

RunDetails r = this.ma.GetLastRun();
this.PerformPostRunActions(r);
using (RunDetails r = this.ma.GetLastRun())
{
this.PerformPostRunActions(r);
}
}
catch (OperationCanceledException)
{
Expand Down Expand Up @@ -337,8 +339,10 @@ private void WaitOnUnmanagedRun()

if (!this.token.IsCancellationRequested)
{
RunDetails ur = this.ma.GetLastRun();
this.PerformPostRunActions(ur);
using (RunDetails ur = this.ma.GetLastRun())
{
this.PerformPostRunActions(ur);
}
}
}
finally
Expand Down
2 changes: 1 addition & 1 deletion src/Lithnet.Miiserver.AutoSync/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static int MailMaxErrorItems

int value;

return int.TryParse(s, out value) ? value : 0;
return int.TryParse(s, out value) ? value : 10;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,18 @@ private void SetupListener()

private void Notify(IAsyncResult result)
{
PartialResultsCollection col;

try
{
if (this.stopped)
{
this.connection.EndSendRequest(result);
return;
}

PartialResultsCollection col = this.connection.GetPartialResults(result);

col = this.connection.GetPartialResults(result);
if (this.hasChanges)
{
return;
Expand Down Expand Up @@ -154,7 +156,7 @@ private void Notify(IAsyncResult result)
continue;
}
}

Logger.WriteLine("AD change: {0}", r.DistinguishedName);
Logger.WriteLine("LL: {0}", LogLevel.Debug, date1.ToLocalTime());
Logger.WriteLine("TS: {0}", LogLevel.Debug, date2.ToLocalTime());
Expand All @@ -175,6 +177,10 @@ private void Notify(IAsyncResult result)
throw;
}
}
finally
{
col = null;
}
}

public void Start()
Expand Down

0 comments on commit c652db8

Please sign in to comment.