@@ -125,7 +125,7 @@ func newChecker(saDbMap certDB,
125125 }
126126}
127127
128- func (c * certChecker ) getCerts (unexpiredOnly bool ) error {
128+ func (c * certChecker ) getCerts (ctx context. Context , unexpiredOnly bool ) error {
129129 c .issuedReport .end = c .clock .Now ()
130130 c .issuedReport .begin = c .issuedReport .end .Add (- c .checkPeriod )
131131
@@ -139,7 +139,7 @@ func (c *certChecker) getCerts(unexpiredOnly bool) error {
139139 var retries int
140140 for {
141141 sni , err = c .dbMap .SelectNullInt (
142- context . Background () ,
142+ ctx ,
143143 "SELECT MIN(id) FROM certificates WHERE issued >= :issued AND expires >= :now" ,
144144 args ,
145145 )
@@ -171,7 +171,7 @@ func (c *certChecker) getCerts(unexpiredOnly bool) error {
171171
172172 for {
173173 certs , err := sa .SelectCertificates (
174- context . Background () ,
174+ ctx ,
175175 c .dbMap ,
176176 "WHERE id > :id AND issued >= :issued AND expires >= :now ORDER BY id LIMIT :limit" ,
177177 args ,
@@ -201,9 +201,9 @@ func (c *certChecker) getCerts(unexpiredOnly bool) error {
201201 return nil
202202}
203203
204- func (c * certChecker ) processCerts (wg * sync.WaitGroup , badResultsOnly bool , ignoredLints map [string ]bool ) {
204+ func (c * certChecker ) processCerts (ctx context. Context , wg * sync.WaitGroup , badResultsOnly bool , ignoredLints map [string ]bool ) {
205205 for cert := range c .certs {
206- dnsNames , problems := c .checkCert (context . Background () , cert , ignoredLints )
206+ dnsNames , problems := c .checkCert (ctx , cert , ignoredLints )
207207 valid := len (problems ) == 0
208208 c .rMu .Lock ()
209209 if ! badResultsOnly || (badResultsOnly && ! valid ) {
@@ -388,7 +388,7 @@ func (c *certChecker) checkCert(ctx context.Context, cert core.Certificate, igno
388388 if err != nil {
389389 problems = append (problems , fmt .Sprintf ("Couldn't parse stored certificate: %s" , err ))
390390 }
391- err = c .kp .GoodKey (context . Background () , p .PublicKey )
391+ err = c .kp .GoodKey (ctx , p .PublicKey )
392392 if err != nil {
393393 problems = append (problems , fmt .Sprintf ("Key Policy isn't willing to issue for public key: %s" , err ))
394394 }
@@ -533,7 +533,7 @@ func main() {
533533 // is finished it will close the certificate channel which allows the range
534534 // loops in checker.processCerts to break
535535 go func () {
536- err := checker .getCerts (config .CertChecker .UnexpiredOnly )
536+ err := checker .getCerts (context . TODO (), config .CertChecker .UnexpiredOnly )
537537 cmd .FailOnError (err , "Batch retrieval of certificates failed" )
538538 }()
539539
@@ -543,7 +543,7 @@ func main() {
543543 wg .Add (1 )
544544 go func () {
545545 s := checker .clock .Now ()
546- checker .processCerts (wg , config .CertChecker .BadResultsOnly , ignoredLintsMap )
546+ checker .processCerts (context . TODO (), wg , config .CertChecker .BadResultsOnly , ignoredLintsMap )
547547 checkerLatency .Observe (checker .clock .Since (s ).Seconds ())
548548 }()
549549 }
0 commit comments