MCPcopy
hub / github.com/caddyserver/caddy / keepStorageClean

Method keepStorageClean

modules/caddytls/tls.go:909–928  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

907// known storage units if it was not recently done, and then runs the
908// operation at every tick from t.storageCleanTicker.
909func (t *TLS) keepStorageClean() {
910 t.storageCleanTicker = time.NewTicker(t.storageCleanInterval())
911 t.storageCleanStop = make(chan struct{})
912 go func() {
913 defer func() {
914 if err := recover(); err != nil {
915 log.Printf("[PANIC] storage cleaner: %v\n%s", err, debug.Stack())
916 }
917 }()
918 t.cleanStorageUnits()
919 for {
920 select {
921 case <-t.storageCleanStop:
922 return
923 case <-t.storageCleanTicker.C:
924 t.cleanStorageUnits()
925 }
926 }
927 }()
928}
929
930func (t *TLS) cleanStorageUnits() {
931 storageCleanMu.Lock()

Callers 1

StartMethod · 0.95

Calls 2

storageCleanIntervalMethod · 0.95
cleanStorageUnitsMethod · 0.95

Tested by

no test coverage detected