Skip to content

Commit 8f00ab4

Browse files
committed
cmd/sunlight: pull roots and logs at start in a goroutine
1 parent ac1a3bf commit 8f00ab4

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

cmd/sunlight/sunlight.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -594,10 +594,12 @@ func main() {
594594
fatalError(logger, "CCADBRoots must be 'trusted', 'testing', or empty",
595595
"CCADBRoots", lc.CCADBRoots)
596596
}
597-
// We don't run loadCCADBRoots at start, because CCADB is very
598-
// flakey, so we don't want to prevent the log from starting if it's
599-
// down. The previous roots will be loaded by LoadLog anyway.
600597
serveGroup.Go(func() error {
598+
if newRoots, err := loadCCADBRoots(ctx, lc, l); err != nil {
599+
logger.Error("failed to load initial CCADB roots", "err", err)
600+
} else if newRoots {
601+
logger.Info("successfully loaded new roots from CCADB/ExtraRoots")
602+
}
601603
ticker := time.NewTicker(15 * time.Minute)
602604
for {
603605
select {
@@ -606,12 +608,9 @@ func main() {
606608
case <-reloadChan:
607609
case <-ticker.C:
608610
}
609-
newRoots, err := loadCCADBRoots(ctx, lc, l)
610-
if err != nil {
611+
if newRoots, err := loadCCADBRoots(ctx, lc, l); err != nil {
611612
logger.Error("failed to reload CCADB roots", "err", err)
612-
continue
613-
}
614-
if newRoots {
613+
} else if newRoots {
615614
logger.Info("successfully loaded new roots from CCADB/ExtraRoots on SIGHUP or timer")
616615
}
617616
}
@@ -701,6 +700,9 @@ func main() {
701700
reloadChan := make(chan os.Signal, 1)
702701
signal.Notify(reloadChan, syscall.SIGHUP)
703702
serveGroup.Go(func() error {
703+
if err := w.PullLogList(ctx, c.Witness.LogList); err != nil {
704+
logger.Error("failed to pull log list", "err", err)
705+
}
704706
ticker := time.NewTicker(15 * time.Minute)
705707
for {
706708
select {

0 commit comments

Comments
 (0)