diff --git a/cpp/core/LogsDB.cpp b/cpp/core/LogsDB.cpp index 8b5f1f91..fa862b5f 100644 --- a/cpp/core/LogsDB.cpp +++ b/cpp/core/LogsDB.cpp @@ -544,15 +544,20 @@ class ReqResp { void resendTimedOutRequests() { auto now = eggsNow(); - auto cutoffTime = now - LogsDB::RESPONSE_TIMEOUT; + auto defaultCutoffTime = now - LogsDB::RESPONSE_TIMEOUT; auto releaseCutoffTime = now - LogsDB::SEND_RELEASE_INTERVAL; + auto readCutoffTime = now - LogsDB::READ_TIMEOUT; + auto cutoffTime = now; for (auto& r : _requests) { - if (unlikely(r.second.header.kind == LogMessageKind::RELEASE)) { - if (r.second.sentTime < releaseCutoffTime) { - r.second.sentTime = now; - _requestsToSend.emplace_back(&r.second); - } - continue; + switch (r.second.header.kind) { + case LogMessageKind::RELEASE: + cutoffTime = releaseCutoffTime; + break; + case LogMessageKind::LOG_READ: + cutoffTime = readCutoffTime; + break; + default: + cutoffTime = defaultCutoffTime; } if (r.second.sentTime < cutoffTime) { r.second.sentTime = now; diff --git a/cpp/core/LogsDB.hpp b/cpp/core/LogsDB.hpp index 7dc80403..0afcfe2e 100644 --- a/cpp/core/LogsDB.hpp +++ b/cpp/core/LogsDB.hpp @@ -71,10 +71,11 @@ public: static constexpr size_t REPLICA_COUNT = 5; static constexpr Duration PARTITION_TIME_SPAN = 12_hours; static constexpr Duration RESPONSE_TIMEOUT = 10_ms; + static constexpr Duration READ_TIMEOUT = 1_sec; static constexpr Duration SEND_RELEASE_INTERVAL = 300_ms; static constexpr Duration LEADER_INACTIVE_TIMEOUT = 1_sec; static constexpr size_t IN_FLIGHT_APPEND_WINDOW = 1 << 8; - static constexpr size_t CATCHUP_WINDOW = 1 << 4 ; + static constexpr size_t CATCHUP_WINDOW = 1 << 8 ; LogsDB() = delete;