mirror of
https://github.com/SSLMate/certspotter.git
synced 2025-06-27 10:15:33 +02:00
Simplify context cancellation checks
This commit is contained in:
parent
56af38ca70
commit
90ead642b0
@ -137,9 +137,10 @@ func (daemon *daemon) run(ctx context.Context) error {
|
||||
healthCheckTicker := time.NewTicker(daemon.config.HealthCheckInterval)
|
||||
defer healthCheckTicker.Stop()
|
||||
|
||||
for ctx.Err() == nil {
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
case <-reloadLogListTicker.C:
|
||||
if err := daemon.loadLogList(ctx); err != nil {
|
||||
daemon.logListError = err.Error()
|
||||
@ -153,7 +154,6 @@ func (daemon *daemon) run(ctx context.Context) error {
|
||||
}
|
||||
}
|
||||
}
|
||||
return ctx.Err()
|
||||
}
|
||||
|
||||
func Run(ctx context.Context, config *Config) error {
|
||||
|
@ -444,11 +444,6 @@ func generateBatchesWorker(ctx context.Context, config *Config, ctlog *loglist.L
|
||||
|
||||
func downloadWorker(ctx context.Context, config *Config, ctlog *loglist.Log, client ctclient.Log, batchesIn <-chan *batch, batchesOut chan<- *batch) error {
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
default:
|
||||
}
|
||||
var batch *batch
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
@ -462,11 +457,6 @@ func downloadWorker(ctx context.Context, config *Config, ctlog *loglist.Log, cli
|
||||
}
|
||||
batch.entries = entries
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
default:
|
||||
}
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
@ -477,11 +467,6 @@ func downloadWorker(ctx context.Context, config *Config, ctlog *loglist.Log, cli
|
||||
|
||||
func processWorker(ctx context.Context, config *Config, ctlog *loglist.Log, issuerGetter ctclient.IssuerGetter, batchesIn <-chan *batch, batchesOut *sequencer.Channel[batch]) error {
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
default:
|
||||
}
|
||||
var batch *batch
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
|
Loading…
x
Reference in New Issue
Block a user