10
10
using Microsoft . AspNetCore . Http ;
11
11
using Microsoft . Azure . WebJobs . Logging ;
12
12
using Microsoft . Azure . WebJobs . Script . Extensions ;
13
+ using Microsoft . Extensions . Configuration ;
13
14
using Microsoft . Extensions . FileProviders ;
14
15
using Microsoft . Extensions . Logging ;
15
16
using Microsoft . Extensions . Options ;
@@ -25,17 +26,20 @@ public class StandbyManager : IStandbyManager
25
26
private readonly IScriptHostManager _scriptHostManager ;
26
27
private readonly IOptionsMonitor < ScriptApplicationHostOptions > _options ;
27
28
private readonly Lazy < Task > _specializationTask ;
29
+ private readonly IConfigurationRoot _configuration ;
28
30
private readonly ILogger _logger ;
29
31
private static CancellationTokenSource _standbyCancellationTokenSource = new CancellationTokenSource ( ) ;
30
32
private static IChangeToken _standbyChangeToken = new CancellationChangeToken ( _standbyCancellationTokenSource . Token ) ;
31
33
private static SemaphoreSlim _semaphore = new SemaphoreSlim ( 1 , 1 ) ;
32
34
33
- public StandbyManager ( IScriptHostManager scriptHostManager , IOptionsMonitor < ScriptApplicationHostOptions > options , ILoggerFactory loggerFactory )
35
+ public StandbyManager ( IScriptHostManager scriptHostManager , IConfiguration configuration , IOptionsMonitor < ScriptApplicationHostOptions > options , ILoggerFactory loggerFactory )
34
36
{
35
37
_scriptHostManager = scriptHostManager ?? throw new ArgumentNullException ( nameof ( scriptHostManager ) ) ;
36
38
_options = options ?? throw new ArgumentNullException ( nameof ( options ) ) ;
37
39
_logger = loggerFactory . CreateLogger ( LogCategories . Startup ) ;
38
40
_specializationTask = new Lazy < Task > ( SpecializeHostCoreAsync , LazyThreadSafetyMode . ExecutionAndPublication ) ;
41
+
42
+ _configuration = configuration as IConfigurationRoot ;
39
43
}
40
44
41
45
public static IChangeToken ChangeToken => _standbyChangeToken ;
@@ -47,6 +51,9 @@ public Task SpecializeHostAsync()
47
51
48
52
public async Task SpecializeHostCoreAsync ( )
49
53
{
54
+ // Trigger a configuration reload to pick up all current settings
55
+ _configuration ? . Reload ( ) ;
56
+
50
57
NotifyChange ( ) ;
51
58
52
59
await _scriptHostManager . RestartHostAsync ( ) ;
0 commit comments