Skip to content

Commit ae05f55

Browse files
committed
stop before dispose a scriptHostManager
1 parent a2c2693 commit ae05f55

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

src/WebJobs.Script.WebHost/App_Start/WebHostResolver.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ internal void EnsureInitialized(WebHostSettings settings)
136136
TimeZoneInfo.ClearCachedData();
137137
}
138138

139-
_standbyHostManager?.Dispose();
139+
if (_standbyHostManager != null)
140+
{
141+
_standbyHostManager.Stop();
142+
_standbyHostManager.Dispose();
143+
}
140144
_standbyReceiverManager?.Dispose();
141145
_standbyScriptHostConfig = null;
142146
_standbyHostManager = null;

src/WebJobs.Script.WebHost/Security/FileSystemSecretsRepository.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ public async Task PurgeOldSecretsAsync(IList<string> currentFunctions, TraceWrit
113113
{
114114
try
115115
{
116+
// destructive operation, thus log
117+
string removeSecretsMessage = $"Deleting secret file {secretFile.FullName}";
118+
traceWriter.Verbose(removeSecretsMessage);
119+
logger?.LogDebug(removeSecretsMessage);
116120
await FileUtility.DeleteIfExistsAsync(secretFile.FullName);
117121
}
118122
catch

src/WebJobs.Script/Host/ScriptHost.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,10 @@ private void PurgeOldLogDirectories()
775775
// so delete it
776776
try
777777
{
778+
// destructive operation, thus log
779+
string removeLogMessage = $"Deleting log directory '{logDir.FullName}'";
780+
TraceWriter.Verbose(removeLogMessage);
781+
_startupLogger?.LogDebug(removeLogMessage);
778782
logDir.Delete(recursive: true);
779783
}
780784
catch

test/WebJobs.Script.Tests.Integration/Host/StandbyManagerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public async Task StandbyMode_EndToEnd()
129129
// verify logs
130130
string[] logLines = traceWriter.Traces.Select(p => p.Message).ToArray();
131131
Assert.Equal(2, logLines.Count(p => p.Contains("Host is in standby mode")));
132-
Assert.Equal(1, logLines.Count(p => p.Contains("Stopping Host")));
132+
Assert.Equal(2, logLines.Count(p => p.Contains("Stopping Host")));
133133
Assert.Equal(2, logLines.Count(p => p.Contains("Executed 'Functions.WarmUp' (Succeeded")));
134134
Assert.Equal(1, logLines.Count(p => p.Contains("Starting host specialization")));
135135

0 commit comments

Comments
 (0)