summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Holt <mholt@users.noreply.github.com>2021-11-02 08:27:25 -0600
committerGitHub <noreply@github.com>2021-11-02 08:27:25 -0600
commit24fda7514ddeebf19a1e872343b45ec523eefcba (patch)
tree19e6b0c56c5bf99ca5975910ecdb5cacb64cd1fa
parent3385856966dc03e438d6aef58db7dcb370d4b045 (diff)
caddytls: Mark storage clean timestamp at end of routine (#4401)
See discussion on 42b7134ffa3bf3e9e86514c82407979c2627a5ab
-rw-r--r--modules/caddytls/tls.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/modules/caddytls/tls.go b/modules/caddytls/tls.go
index 778ae02..31c559c 100644
--- a/modules/caddytls/tls.go
+++ b/modules/caddytls/tls.go
@@ -458,20 +458,17 @@ func (t *TLS) cleanStorageUnits() {
defer storageCleanMu.Unlock()
// If storage was cleaned recently, don't do it again for now. Although the ticker
- // drops missed ticks for us, config reloads discard the old ticker and replace it
- // with a new one, possibly invoking a cleaning to happen again too soon.
- // (We divide the interval by 2 because the actual cleaning takes non-zero time,
- // and we don't want to skip cleanings if we don't have to; whereas if a cleaning
- // took the entire interval, we'd probably want to skip the next one so we aren't
+ // calling this function drops missed ticks for us, config reloads discard the old
+ // ticker and replace it with a new one, possibly invoking a cleaning to happen again
+ // too soon. (We divide the interval by 2 because the actual cleaning takes non-zero
+ // time, and we don't want to skip cleanings if we don't have to; whereas if a cleaning
+ // took most of the interval, we'd probably want to skip the next one so we aren't
// constantly cleaning. This allows cleanings to take up to half the interval's
// duration before we decide to skip the next one.)
if !storageClean.IsZero() && time.Since(storageClean) < t.storageCleanInterval()/2 {
return
}
- // mark when storage cleaning was last initiated
- storageClean = time.Now()
-
options := certmagic.CleanStorageOptions{
OCSPStaples: true,
ExpiredCerts: true,
@@ -504,6 +501,9 @@ func (t *TLS) cleanStorageUnits() {
}
}
+ // remember last time storage was finished cleaning
+ storageClean = time.Now()
+
t.logger.Info("finished cleaning storage units")
}