mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-27 12:25:55 +03:00
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).
This commit is contained in:
parent
0bf2565c37
commit
efc0cc5e85
1 changed files with 4 additions and 4 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue