Remove improper assertion use from beagle cache handling code
This commit is contained in:
@@ -40,8 +40,17 @@ BeagleQueueCache::BeagleQueueCache(RclConfig *cnf)
|
||||
|
||||
int maxmbs = 40;
|
||||
cnf->getConfParam("webcachemaxmbs", &maxmbs);
|
||||
m_cache = new CirCache(ccdir);
|
||||
m_cache->create(off_t(maxmbs)*1000*1024, CirCache::CC_CRUNIQUE);
|
||||
if ((m_cache = new CirCache(ccdir)) == 0) {
|
||||
LOGERR(("BeagleQueueCache: cant create CirCache object\n"));
|
||||
return;
|
||||
}
|
||||
if (!m_cache->create(off_t(maxmbs)*1000*1024, CirCache::CC_CRUNIQUE)) {
|
||||
LOGERR(("BeagleQueueCache: cache file creation failed: %s\n",
|
||||
m_cache->getReason().c_str()));
|
||||
delete m_cache;
|
||||
m_cache = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
BeagleQueueCache::~BeagleQueueCache()
|
||||
@@ -52,12 +61,18 @@ BeagleQueueCache::~BeagleQueueCache()
|
||||
// Read document from cache. Return the metadata as an Rcl::Doc
|
||||
// @param htt Beagle Hit Type
|
||||
bool BeagleQueueCache::getFromCache(const string& udi, Rcl::Doc &dotdoc,
|
||||
string& data, string *htt)
|
||||
string& data, string *htt)
|
||||
{
|
||||
string dict;
|
||||
|
||||
if (!m_cache->get(udi, dict, data))
|
||||
return false;
|
||||
if (m_cache == 0) {
|
||||
LOGERR(("BeagleQueueCache::getFromCache: cache is null\n"));
|
||||
return false;
|
||||
}
|
||||
if (!m_cache->get(udi, dict, data)) {
|
||||
LOGDEB(("BeagleQueueCache::getFromCache: get failed\n"));
|
||||
return false;
|
||||
}
|
||||
|
||||
ConfSimple cf(dict, 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user