diff --git a/cache.go b/cache.go index 8ed6a1a..6f4db27 100644 --- a/cache.go +++ b/cache.go @@ -81,6 +81,7 @@ func getCache(context context.Context, path string) (creationTime int64, header func saveCache(path string, now time.Time, header map[string][]string, body []byte) { headerBytes, _ := json.Marshal(header) startWritingToDb() + defer finishWritingToDb() tx, err := appDb.Begin() if err != nil { return @@ -88,16 +89,15 @@ func saveCache(path string, now time.Time, header map[string][]string, body []by _, _ = tx.Exec("delete from cache where time