This repository was archived by the owner on Jul 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
src/Validation.PackageSigning.RevalidateCertificate Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,22 +19,23 @@ public class Job : ValidationJobBase
1919 {
2020 private const string RevalidationConfigurationSectionName = "RevalidateJob" ;
2121
22- private ICertificateRevalidator _revalidator ;
23-
2422 public override void Init ( IServiceContainer serviceContainer , IDictionary < string , string > jobArgsDictionary )
2523 {
2624 base . Init ( serviceContainer , jobArgsDictionary ) ;
27-
28- _revalidator = _serviceProvider . GetRequiredService < ICertificateRevalidator > ( ) ;
2925 }
3026
3127 public override async Task Run ( )
3228 {
33- // Both of these methods only do a chunk of the possible promotion/revalidating work before
34- // completing. This "Run" method may need to run several times to promote all signatures
35- // and to revalidate all stale certificates.
36- await _revalidator . PromoteSignaturesAsync ( ) ;
37- await _revalidator . RevalidateStaleCertificatesAsync ( ) ;
29+ using ( var scope = _serviceProvider . CreateScope ( ) )
30+ {
31+ var revalidator = scope . ServiceProvider . GetRequiredService < ICertificateRevalidator > ( ) ;
32+
33+ // Both of these methods only do a chunk of the possible promotion/revalidating work before
34+ // completing. This "Run" method may need to run several times to promote all signatures
35+ // and to revalidate all stale certificates.
36+ await revalidator . PromoteSignaturesAsync ( ) ;
37+ await revalidator . RevalidateStaleCertificatesAsync ( ) ;
38+ }
3839 }
3940
4041 protected override void ConfigureJobServices ( IServiceCollection services , IConfigurationRoot configurationRoot )
You can’t perform that action at this time.
0 commit comments