From a6b18c868bcf32ddb14ddea79281fa3c12e22803 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 6 Dec 2012 03:04:41 +0900 Subject: [PATCH] Log size before flush --- src/WrDiskCache.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WrDiskCache.cc b/src/WrDiskCache.cc index 79af80e9..cd204ea6 100644 --- a/src/WrDiskCache.cc +++ b/src/WrDiskCache.cc @@ -112,12 +112,12 @@ void WrDiskCache::ensureLimit() { while(total_ > limit_) { EntrySet::iterator i = set_.begin(); - total_ -= (*i)->getSize(); - (*i)->writeToDisk(); WrDiskCacheEntry* ent = *i; A2_LOG_DEBUG(fmt("Force flush cache entry size=%lu, clock=%"PRId64, static_cast(ent->getSizeKey()), ent->getLastUpdate())); + total_ -= ent->getSize(); + ent->writeToDisk(); set_.erase(i); ent->setSizeKey(ent->getSize());