From 18fcc20f84adcd092f70d8adb1731113500500e7 Mon Sep 17 00:00:00 2001 From: Kyungwook Tak Date: Wed, 25 May 2016 13:50:56 +0900 Subject: [PATCH] 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 --- src/framework/service/cs-logic.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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; } -- 2.7.4