Increased delay after error from 60 to 120 seconds

This commit is contained in:
tastytea 2018-06-02 14:43:18 +02:00
parent bf608f5145
commit b147b42b79
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
2 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.7) cmake_minimum_required (VERSION 3.7)
project (expandurl-mastodon project (expandurl-mastodon
VERSION 0.9.2 VERSION 0.9.3
LANGUAGES CXX LANGUAGES CXX
) )

View File

@ -85,6 +85,7 @@ const void Listener::read_config()
const void Listener::start() const void Listener::start()
{ {
constexpr uint_fast8_t delay_after_error = 120;
static std::uint_fast16_t ret; static std::uint_fast16_t ret;
_thread = std::thread([=] _thread = std::thread([=]
{ {
@ -99,8 +100,8 @@ const void Listener::start()
if (ret != 0 && ret != 14) // 14 means canceled by user if (ret != 0 && ret != 14) // 14 means canceled by user
{ {
syslog(LOG_ERR, "Connection terminated: Error %u", ret); syslog(LOG_ERR, "Connection terminated: Error %u", ret);
syslog(LOG_INFO, "Waiting for 60 seconds"); syslog(LOG_INFO, "Waiting for %u seconds", delay_after_error);
std::this_thread::sleep_for(std::chrono::seconds(60)); std::this_thread::sleep_for(std::chrono::seconds(delay_after_error));
} }
_running = false; _running = false;
}); });
@ -115,7 +116,7 @@ const void Listener::start()
} }
else if (ret != 14) else if (ret != 14)
{ // If the stream thread sleeps, the main thread should sleep too { // If the stream thread sleeps, the main thread should sleep too
std::this_thread::sleep_for(std::chrono::seconds(60)); std::this_thread::sleep_for(std::chrono::seconds(delay_after_error));
} }
} }