summaryrefslogtreecommitdiff
path: root/modules/caddypki
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-05-12 11:36:20 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2020-05-12 11:36:20 -0600
commitaef560c7fc52092a412d9e97112b8cb879c5eda5 (patch)
tree905fce22478842dd8a8d07a65c8769e7db1c4cad /modules/caddypki
parent44536a7594f060dfca54a3cfb36135c93cba8e59 (diff)
all: Recover from panics in goroutines
Diffstat (limited to 'modules/caddypki')
-rw-r--r--modules/caddypki/maintain.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/caddypki/maintain.go b/modules/caddypki/maintain.go
index 2fce0d9..c0b277d 100644
--- a/modules/caddypki/maintain.go
+++ b/modules/caddypki/maintain.go
@@ -17,12 +17,20 @@ package caddypki
import (
"crypto/x509"
"fmt"
+ "log"
+ "runtime/debug"
"time"
"go.uber.org/zap"
)
func (p *PKI) maintenance() {
+ defer func() {
+ if err := recover(); err != nil {
+ log.Printf("[PANIC] PKI maintenance: %v\n%s", err, debug.Stack())
+ }
+ }()
+
ticker := time.NewTicker(10 * time.Minute) // TODO: make configurable
defer ticker.Stop()