]> gitweb.ps.run Git - ps-cgit/blobdiff - cgit.c
Don't truncate valid cachefiles
[ps-cgit] / cgit.c
diff --git a/cgit.c b/cgit.c
index d1abaa052135a8be8f0a13c0ccb9e7c53c4c8347..0f72f2d67ba9e81c97da65d03552eff117794d18 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -61,13 +61,19 @@ static void cgit_check_cache(struct cacheitem *item)
                        sleep(1);
                        goto top;
                }
-               if (!cache_exist(item))
+               if (!cache_exist(item)) {
                        cgit_fill_cache(item);
-               cache_unlock(item);
+                       cache_unlock(item);
+               } else {
+                       cache_cancel_lock(item);
+               }
        } else if (cache_expired(item) && cache_lock(item)) {
-               if (cache_expired(item))
+               if (cache_expired(item)) {
                        cgit_fill_cache(item);
-               cache_unlock(item);
+                       cache_unlock(item);
+               } else {
+                       cache_cancel_lock(item);
+               }
        }
 }