about summary refs log tree commit diff
path: root/cgit.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cgit.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/cgit.c b/cgit.c
index d1abaa0..0f72f2d 100644
--- 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);
+		}
 	}
 }