aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--internal/feed/cache.go6
-rw-r--r--tools/print-cache/print-cache.go2
2 files changed, 7 insertions, 1 deletions
diff --git a/internal/feed/cache.go b/internal/feed/cache.go
index fa22139..bf64c4a 100644
--- a/internal/feed/cache.go
+++ b/internal/feed/cache.go
@@ -104,8 +104,12 @@ func storeCache(cache Cache, fileName string) error {
writer.Flush()
log.Printf("Stored cache to '%s'.", fileName)
+ return UnlockCache(cache)
+}
+
+func UnlockCache(cache Cache) error {
if cache.locked {
- if err = cache.lock.Unlock(); err != nil {
+ if err := cache.lock.Unlock(); err != nil {
return fmt.Errorf("Unlocking cache: %w", err)
}
}
diff --git a/tools/print-cache/print-cache.go b/tools/print-cache/print-cache.go
index d20963a..b21643e 100644
--- a/tools/print-cache/print-cache.go
+++ b/tools/print-cache/print-cache.go
@@ -27,6 +27,8 @@ func main() {
log.Fatal(err)
}
+ defer func() {_ = feed.UnlockCache(cache)}()
+
fmt.Printf("Cache version %d\n", cache.Version())
if feedId != "" {
fmt.Print(cache.SpecificInfo(feedId))