summaryrefslogtreecommitdiff
path: root/modules/caddytls
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-07-08 10:59:49 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2020-07-08 10:59:49 -0600
commitefc0cc5e8557ebc54dd30931a27767139e808c80 (patch)
tree39c67a5a82223042c0dd16ae57a9f042c50d39e4 /modules/caddytls
parent0bf2565c37c0b2e4857be70c5302d6ad5c34b80d (diff)
caddytls: Move initial storage clean op into goroutine
Sometimes this operation can take a while (we observed 7 minutes recently, with a large, globally-distributed storage backend).
Diffstat (limited to 'modules/caddytls')
-rw-r--r--modules/caddytls/tls.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/caddytls/tls.go b/modules/caddytls/tls.go
index cc89ef5..b2d05be 100644
--- a/modules/caddytls/tls.go
+++ b/modules/caddytls/tls.go
@@ -373,9 +373,9 @@ func (t *TLS) AllMatchingCertificates(san string) []certmagic.Certificate {
return t.certCache.AllMatchingCertificates(san)
}
-// keepStorageClean immediately cleans up all known storage units
-// if it was not recently done, and starts a goroutine that runs
-// the operation at every tick from t.storageCleanTicker.
+// keepStorageClean starts a goroutine that immediately cleans up all
+// known storage units if it was not recently done, and then runs the
+// operation at every tick from t.storageCleanTicker.
func (t *TLS) keepStorageClean() {
t.storageCleanTicker = time.NewTicker(storageCleanInterval)
t.storageCleanStop = make(chan struct{})
@@ -385,6 +385,7 @@ func (t *TLS) keepStorageClean() {
log.Printf("[PANIC] storage cleaner: %v\n%s", err, debug.Stack())
}
}()
+ t.cleanStorageUnits()
for {
select {
case <-t.storageCleanStop:
@@ -394,7 +395,6 @@ func (t *TLS) keepStorageClean() {
}
}
}()
- t.cleanStorageUnits()
}
func (t *TLS) cleanStorageUnits() {