Skip to content

Commit bac8ed5

Browse files
committed
client: log timeout with debug level
Currently, we log that timeout is exceeded with error level. The problem is there are no dedicated methods for polling so users have to use `wait` methods, and when they use them, they spam timeout errors. Anyway, we return -1 on timeout, so users can log timeouts on their own. What's about tests - we have no convenient way to check the logs now, so let's simply change log level without tests, the commit is trivial anyway. Closes #109
1 parent dfe5389 commit bac8ed5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Client/Connector.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ Connector<BUFFER, NetProvider>::wait(Connection<BUFFER, NetProvider> &conn,
210210
return -1;
211211
}
212212
if (! conn.futureIsReady(future)) {
213-
LOG_ERROR("Connection has been timed out: future ", future,
213+
LOG_DEBUG("Connection has been timed out: future ", future,
214214
" is not ready");
215215
return -1;
216216
}
@@ -257,7 +257,7 @@ Connector<BUFFER, NetProvider>::waitAll(Connection<BUFFER, NetProvider> &conn,
257257
LOG_ERROR("Connection got an error: ", conn.getError().msg);
258258
return -1;
259259
}
260-
LOG_ERROR("Connection has been timed out: not all futures are ready");
260+
LOG_DEBUG("Connection has been timed out: not all futures are ready");
261261
return -1;
262262
}
263263

@@ -273,7 +273,7 @@ Connector<BUFFER, NetProvider>::waitAny(int timeout)
273273
break;
274274
}
275275
if (m_ReadyToDecode.empty()) {
276-
LOG_ERROR("wait() has been timed out! No responses are received");
276+
LOG_DEBUG("wait() has been timed out! No responses are received");
277277
return std::nullopt;
278278
}
279279
Connection<BUFFER, NetProvider> conn = *m_ReadyToDecode.begin();
@@ -315,8 +315,8 @@ Connector<BUFFER, NetProvider>::waitCount(Connection<BUFFER, NetProvider> &conn,
315315
LOG_ERROR("Connection got an error: ", conn.getError().msg);
316316
return -1;
317317
}
318-
LOG_ERROR("Connection has been timed out: only ",
319-
conn.getFutureCount() - ready_futures, " are ready");
318+
LOG_DEBUG("Connection has been timed out: only ",
319+
conn.getFutureCount() - ready_futures, " are ready");
320320
return -1;
321321
}
322322

src/Client/LibevNetProvider.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ void
354354
LibevNetProvider<BUFFER, Stream>::timeout_cb(EV_P_ ev_timer *w, int /* revents */)
355355
{
356356
(void) w;
357-
LOG_ERROR("Libev timed out!");
357+
LOG_DEBUG("Libev timed out!");
358358
/* Stop external loop */
359359
ev_break(EV_A_ EVBREAK_ONE);
360360
}

0 commit comments

Comments
 (0)