mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-02 06:56:36 +08:00
autoresearch iter 5: recover panics in background cleanup loops
Four long-running goroutines were launched with a bare go statement, so a
panic in any of them took down the whole process: the RAM cache's expired-key
eviction, the batch writer's flush worker, the disk cache cleanup worker and
the PoW memory store sweeper. Route them through util.Go.
The architecture gate only grepped for 'go func(', which is why the named-call
form went unnoticed; widen it to cover both launch styles.
This commit is contained in:
Vendored
+2
-1
@@ -4,6 +4,7 @@
|
||||
package ram
|
||||
|
||||
import (
|
||||
"Wavelet/pkg/util"
|
||||
"context"
|
||||
"errors"
|
||||
"sync"
|
||||
@@ -73,7 +74,7 @@ func Get(configType, key string) (CacheItem, bool) {
|
||||
// Check expiration
|
||||
if entry.item.TTL != -1 && !entry.expireAt.IsZero() && time.Now().After(entry.expireAt) {
|
||||
// Asynchronously remove the expired item from the map and write back
|
||||
go deleteKeyIfExpired(configType, key, entry.expireAt)
|
||||
util.Go(func() { deleteKeyIfExpired(configType, key, entry.expireAt) })
|
||||
return CacheItem{}, false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user