From 9509134f10a2f2290ad17f6b77603a9a92d61e53 Mon Sep 17 00:00:00 2001 From: Cedric CAFFY <cedric.caffy@cern.ch> Date: Wed, 24 Jul 2019 15:39:00 +0200 Subject: [PATCH] Added a timer of 3 minutes to flush the successful Retrieve Request for reporting --- .../castor/tape/tapeserver/daemon/RecallReportPacker.cpp | 6 +++++- .../castor/tape/tapeserver/daemon/RecallReportPacker.hpp | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tapeserver/castor/tape/tapeserver/daemon/RecallReportPacker.cpp b/tapeserver/castor/tape/tapeserver/daemon/RecallReportPacker.cpp index 39d6285b26..f58f6a0ad7 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/RecallReportPacker.cpp +++ b/tapeserver/castor/tape/tapeserver/daemon/RecallReportPacker.cpp @@ -236,6 +236,7 @@ void RecallReportPacker::WorkerThread::run(){ bool endFound = false; std::list <std::unique_ptr<Report>> reportedSuccessfully; + cta::utils::Timer t; while(1) { std::string debugType; std::unique_ptr<Report> rep(m_parent.m_fifo.pop()); @@ -265,8 +266,11 @@ void RecallReportPacker::WorkerThread::run(){ // m_parent.fullCheckAndFinishAsyncExecute will execute the shared half of the // request updates (individual, asynchronous is done in rep->execute(m_parent); if (typeid(*rep) == typeid(RecallReportPacker::ReportSuccessful) - && m_parent.m_successfulRetrieveJobs.size() >= m_parent.RECALL_REPORT_PACKER_FLUSH_SIZE) + && (m_parent.m_successfulRetrieveJobs.size() >= m_parent.RECALL_REPORT_PACKER_FLUSH_SIZE || t.secs() >= m_parent.RECALL_REPORT_PACKER_FLUSH_TIME )){ + m_parent.m_lc.log(cta::log::INFO,"m_parent.fullCheckAndFinishAsyncExecute()"); m_parent.fullCheckAndFinishAsyncExecute(); + t.reset(); + } } catch(const cta::exception::Exception& e){ //we get there because to tried to close the connection and it failed //either from the catch a few lines above or directly from rep->execute diff --git a/tapeserver/castor/tape/tapeserver/daemon/RecallReportPacker.hpp b/tapeserver/castor/tape/tapeserver/daemon/RecallReportPacker.hpp index a0b62a0c62..0a22fdc290 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/RecallReportPacker.hpp +++ b/tapeserver/castor/tape/tapeserver/daemon/RecallReportPacker.hpp @@ -239,6 +239,11 @@ private: * The limit for successful reports to trigger flush. */ const unsigned int RECALL_REPORT_PACKER_FLUSH_SIZE = 500; + + /* + * The time limit for successful reports to trigger flush. + */ + const double RECALL_REPORT_PACKER_FLUSH_TIME = 180; }; }}}} -- GitLab