File tree Expand file tree Collapse file tree 3 files changed +0
-47
lines changed
Expand file tree Collapse file tree 3 files changed +0
-47
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,6 @@ internal class StartupJobManager(
55 JobProcessor jobProcessor ,
66 JobExecutionProgressObserver observer )
77{
8- private readonly AsyncManualResetEvent startupJobsCompleted = new ( ) ;
9-
108 public async Task ProcessStartupJobs ( CancellationToken stopToken )
119 {
1210 var startupJobs = jobRegistry . GetAllOneTimeJobs ( ) ;
@@ -16,22 +14,8 @@ public async Task ProcessStartupJobs(CancellationToken stopToken)
1614 {
1715 await Task . WhenAll ( startupTasks ) . ConfigureAwait ( false ) ;
1816 }
19-
20- startupJobsCompleted . Set ( ) ;
2117 }
2218
2319 private async Task CreateExecutionTask ( JobRun job , CancellationToken stopToken ) =>
2420 await jobProcessor . ProcessJobAsync ( job , stopToken ) . ConfigureAwait ( false ) ;
25-
26- public Task WaitForStartupJobsCompletion ( ) => startupJobsCompleted . WaitAsync ( ) ;
2721}
28-
29- internal class AsyncManualResetEvent
30- {
31- private readonly TaskCompletionSource tcs = new ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
32-
33- public Task WaitAsync ( ) => tcs . Task ;
34-
35- public void Set ( ) => tcs . TrySetResult ( ) ;
36- }
37-
Original file line number Diff line number Diff line change @@ -45,9 +45,4 @@ internal sealed record JobDefinition(
4545 private JobExecutionAttributes JobPolicyMetadata { get ; } = JobPolicyMetadata ?? new JobExecutionAttributes ( Type ) ;
4646 public RetryPolicyAttribute ? RetryPolicy => JobPolicyMetadata . RetryPolicy ;
4747 public SupportsConcurrencyAttribute ? ConcurrencyPolicy => JobPolicyMetadata . ConcurrencyPolicy ;
48-
49- // Hooks for specific state changes
50- public Action < JobDefinition > ? OnCompletion { get ; set ; }
51- public Action < JobDefinition , string ? > ? OnFailure { get ; set ; }
52- public Action < JobDefinition > ? OnRunning { get ; set ; }
5348}
Original file line number Diff line number Diff line change @@ -95,32 +95,6 @@ private void Initialize()
9595 {
9696 OnStateChanged += ( jr , state ) =>
9797 {
98- switch ( state . Type )
99- {
100- case JobStateType . Completed :
101- jr . JobDefinition . OnCompletion ? . Invoke ( jr . JobDefinition ) ;
102- break ;
103- case JobStateType . Faulted :
104- jr . JobDefinition . OnFailure ? . Invoke ( jr . JobDefinition , state . Message ) ;
105- break ;
106- case JobStateType . Running :
107- jr . JobDefinition . OnRunning ? . Invoke ( jr . JobDefinition ) ;
108- break ;
109- case JobStateType . Retrying :
110- case JobStateType . Scheduled :
111- case JobStateType . Cancelled :
112- case JobStateType . Expired :
113- case JobStateType . Skipped :
114- case JobStateType . Crashed :
115- case JobStateType . Completing :
116- case JobStateType . Initializing :
117- case JobStateType . WaitingForDependency :
118- case JobStateType . NotStarted :
119- break ;
120- default :
121- throw new ArgumentOutOfRangeException ( nameof ( state ) , state . Type , "Unexpected JobStateType value" ) ;
122- }
123-
12498 progressReporter ( jr ) ;
12599 } ;
126100
You can’t perform that action at this time.
0 commit comments