From bdf1b3d8eee693327f70e4ff58247ca288389100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Wed, 18 Apr 2018 14:21:06 -0400 Subject: [PATCH] message cache: change failure status after one minute Before this patch a message got a failed status after 3 minutes (3 retries x 1 min). Moreover, if no devices was found, the message is keeped in the cache and wait for the next reboot. So it results in extremely long sending status, which is not really useful for the user. With this patch, the message fails to send after approximately one minute, if the user is connected and we do not receive an answer or if no device is found. Change-Id: I41171be2ebfebc424f96b4a4d42c360ad35ede86 --- src/im/message_engine.h | 2 +- src/ringdht/ringaccount.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/im/message_engine.h b/src/im/message_engine.h index 6d3991ee5b..1e217cc724 100644 --- a/src/im/message_engine.h +++ b/src/im/message_engine.h @@ -70,7 +70,7 @@ public: private: - static const constexpr unsigned MAX_RETRIES = 3; + static const constexpr unsigned MAX_RETRIES = 1; static const std::chrono::minutes RETRY_PERIOD; using clock = std::chrono::steady_clock; diff --git a/src/ringdht/ringaccount.cpp b/src/ringdht/ringaccount.cpp index a3965a24e5..35281d3c42 100644 --- a/src/ringdht/ringaccount.cpp +++ b/src/ringdht/ringaccount.cpp @@ -3362,7 +3362,7 @@ RingAccount::sendTextMessage(const std::string& to, const std::map<std::string, // Timeout cleanup std::weak_ptr<RingAccount> wshared = shared(); Manager::instance().scheduleTask([wshared, confirm, token]() { - if (not confirm->replied and not confirm->listenTokens.empty()) { + if (not confirm->replied) { if (auto this_ = wshared.lock()) { RING_DBG("[Account %s] [message %" PRIx64 "] timeout", this_->getAccountID().c_str(), token); for (auto& t : confirm->listenTokens) -- GitLab