@@ -14,12 +14,14 @@ internal class DebugStateProvider : IDebugStateProvider, IDisposable
14
14
internal const int DebugModeTimeoutMinutes = 15 ;
15
15
internal const int DiagnosticModeTimeoutHours = 3 ;
16
16
private readonly IOptionsMonitor < ScriptApplicationHostOptions > _scriptOptions ;
17
+ private readonly IEnvironment _environment ;
17
18
private IDisposable _debugModeEvent ;
18
19
private IDisposable _diagnosticModeEvent ;
19
20
private bool _disposed ;
20
21
21
- public DebugStateProvider ( IOptionsMonitor < ScriptApplicationHostOptions > scriptOptions , IScriptEventManager eventManager )
22
+ public DebugStateProvider ( IEnvironment environment , IOptionsMonitor < ScriptApplicationHostOptions > scriptOptions , IScriptEventManager eventManager )
22
23
{
24
+ _environment = environment ;
23
25
_debugModeEvent = eventManager . OfType < DebugNotification > ( )
24
26
. Subscribe ( evt => LastDebugNotify = evt . NotificationTime ) ;
25
27
_diagnosticModeEvent = eventManager . OfType < DiagnosticNotification > ( )
@@ -41,8 +43,11 @@ public DebugStateProvider(IOptionsMonitor<ScriptApplicationHostOptions> scriptOp
41
43
42
44
private void InitializeLastNotificationTimes ( )
43
45
{
44
- LastDebugNotify = GetLastWriteTime ( ScriptConstants . DebugSentinelFileName ) ;
45
- LastDiagnosticNotify = GetLastWriteTime ( ScriptConstants . DiagnosticSentinelFileName ) ;
46
+ Utility . ExecuteAfterColdStartDelay ( _environment , ( ) =>
47
+ {
48
+ LastDebugNotify = GetLastWriteTime ( ScriptConstants . DebugSentinelFileName ) ;
49
+ LastDiagnosticNotify = GetLastWriteTime ( ScriptConstants . DiagnosticSentinelFileName ) ;
50
+ } ) ;
46
51
}
47
52
48
53
private DateTime GetLastWriteTime ( string fileName )
0 commit comments