From 4381e816ae575f627f4e873cf823bdf0ff3c0bc4 Mon Sep 17 00:00:00 2001 From: Unbit Date: Wed, 27 Feb 2013 23:00:50 +0100 Subject: [PATCH] fixed cache_del2 --- core/cache.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/core/cache.c b/core/cache.c index 991773f7..aa95a46b 100644 --- a/core/cache.c +++ b/core/cache.c @@ -447,14 +447,10 @@ int uwsgi_cache_del2(struct uwsgi_cache *uc, char *key, uint16_t keylen, uint64_ uci = cache_item(index); uci->keysize = 0; uci->valsize = 0; - if (!uc->blocks_bitmap) { - // try to return to initial condition... - if (index == uc->first_available_block - 1) { - uc->first_available_block--; - //uwsgi_log("FACI: %llu STACK PTR: %llu\n", (unsigned long long) uwsgi.shared->cache_first_available_block, (unsigned long long) uwsgi.shared->cache_unused_blocks_stack_ptr); - } - } - else { + uc->unused_blocks_stack_ptr++; + uc->unused_blocks_stack[uc->unused_blocks_stack_ptr] = index; + // unmark blocks + if (uc->blocks_bitmap) { cache_unmark_blocks(uc, uci->first_block, uci->valsize); } ret = 0;