From: Kyungwook Tak Date: Wed, 25 May 2016 04:50:56 +0000 (+0900) Subject: DB detected item cleanup only when history exist X-Git-Tag: accepted/tizen/common/20160614.143943^2~105 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=18fcc20f84adcd092f70d8adb1731113500500e7;p=platform%2Fupstream%2Fcsr-framework.git DB detected item cleanup only when history exist When scan heavily at first time, it's too much overhead. Delete item only when needed. Change-Id: Iefa55b5e9b04f9a3eb5ea25007b1ee6e42690bfd Signed-off-by: Kyungwook Tak --- diff --git a/src/framework/service/cs-logic.cpp b/src/framework/service/cs-logic.cpp index 1944c6f..b95658c 100644 --- a/src/framework/service/cs-logic.cpp +++ b/src/framework/service/cs-logic.cpp @@ -122,19 +122,23 @@ CsDetectedPtr CsLogic::scanAppDelta(const std::string &pkgPath, const std::strin CsEngineContext engineContext(this->m_loader); auto &c = engineContext.get(); + auto lastScanTime = this->m_db.getLastScanTime(pkgPath, this->m_dataVersion); + // traverse files in app and take which is more danger than riskiest - auto visitor = FsVisitor::create( - pkgPath, - this->m_db.getLastScanTime(pkgPath, this->m_dataVersion)); + auto visitor = FsVisitor::create(pkgPath, lastScanTime); CsDetectedPtr riskiest; while (auto file = visitor->next()) { + DEBUG("Scan file by engine: " << file->getPath()); + csre_cs_detected_h result; toException(this->m_loader.scanFile(c, file->getPath(), &result)); if (!result) { - this->m_db.deleteDetectedByFilepathOnPath(file->getPath()); + if (lastScanTime != -1) + this->m_db.deleteDetectedByFilepathOnPath(file->getPath()); + continue; }