summaryrefslogtreecommitdiffabout
path: root/cgit.c
Side-by-side diff
Diffstat (limited to 'cgit.c') (more/less context) (show whitespace changes)
-rw-r--r--cgit.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/cgit.c b/cgit.c
index 110face..7f14016 100644
--- a/cgit.c
+++ b/cgit.c
@@ -467,8 +467,6 @@ static void cgit_refresh_cache(struct cacheitem *item)
{
+ cache_prepare(item);
top:
- if (!cache_lookup(item)) {
- if (cache_lock(item)) {
- cgit_fill_cache(item);
- cache_unlock(item);
- } else {
+ if (!cache_exist(item)) {
+ if (!cache_lock(item)) {
sched_yield();
@@ -476,7 +474,9 @@ static void cgit_refresh_cache(struct cacheitem *item)
}
- } else if (cache_expired(item)) {
- if (cache_lock(item)) {
+ if (!cache_exist(item))
+ cgit_fill_cache(item);
+ cache_unlock(item);
+ } else if (cache_expired(item) && cache_lock(item)) {
+ if (cache_expired(item))
cgit_fill_cache(item);
cache_unlock(item);
- }
}