-rw-r--r-- | cgit.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -58,19 +58,25 @@ static void cgit_check_cache(struct cacheitem *item) } if (!cache_exist(item)) { if (!cache_lock(item)) { sleep(1); goto top; } - if (!cache_exist(item)) + if (!cache_exist(item)) { cgit_fill_cache(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); + } else { + cache_cancel_lock(item); + } } } static void cgit_print_cache(struct cacheitem *item) { static char buf[4096]; |