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.
()
| 907 | // known storage units if it was not recently done, and then runs the |
| 908 | // operation at every tick from t.storageCleanTicker. |
| 909 | func (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 | |
| 930 | func (t *TLS) cleanStorageUnits() { |
| 931 | storageCleanMu.Lock() |
no test coverage detected