mirror of
https://github.com/caddyserver/caddy.git
synced 2025-12-08 06:09:53 +00:00
all: Recover from panics in goroutines
This commit is contained in:
parent
44536a7594
commit
aef560c7fc
10 changed files with 86 additions and 33 deletions
|
|
@ -16,6 +16,7 @@ package standardstek
|
|||
|
||||
import (
|
||||
"log"
|
||||
"runtime/debug"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
|
@ -81,6 +82,11 @@ func (s *standardSTEKProvider) Next(doneChan <-chan struct{}) <-chan [][32]byte
|
|||
// rotate rotates keys on a regular basis, sending each updated set of
|
||||
// keys down keysChan, until doneChan is closed.
|
||||
func (s *standardSTEKProvider) rotate(doneChan <-chan struct{}, keysChan chan<- [][32]byte) {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
log.Printf("[PANIC] standard STEK rotation: %v\n%s", err, debug.Stack())
|
||||
}
|
||||
}()
|
||||
for {
|
||||
select {
|
||||
case now := <-s.timer.C:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue