Skip to content

Commit 37b79db

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. Closes #109
1 parent 9df0461 commit 37b79db

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Client/Connector.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ Connector<BUFFER, NetProvider>::wait(Connection<BUFFER, NetProvider> &conn,
209209
return -1;
210210
}
211211
if (! conn.futureIsReady(future)) {
212-
LOG_ERROR("Connection has been timed out: future ", future,
212+
LOG_DEBUG("Connection has been timed out: future ", future,
213213
" is not ready");
214214
return -1;
215215
}
@@ -254,7 +254,7 @@ Connector<BUFFER, NetProvider>::waitAll(Connection<BUFFER, NetProvider> &conn,
254254
LOG_ERROR("Connection got an error: ", conn.getError().msg);
255255
return -1;
256256
}
257-
LOG_ERROR("Connection has been timed out: not all futures are ready");
257+
LOG_DEBUG("Connection has been timed out: not all futures are ready");
258258
return -1;
259259
}
260260

@@ -267,7 +267,7 @@ Connector<BUFFER, NetProvider>::waitAny(int timeout)
267267
while (m_ReadyToDecode.empty() && !timer.isExpired())
268268
m_NetProvider.wait(timeout - timer.elapsed());
269269
if (m_ReadyToDecode.empty()) {
270-
LOG_ERROR("wait() has been timed out! No responses are received");
270+
LOG_DEBUG("wait() has been timed out! No responses are received");
271271
return std::nullopt;
272272
}
273273
Connection<BUFFER, NetProvider> conn = *m_ReadyToDecode.begin();
@@ -307,8 +307,8 @@ Connector<BUFFER, NetProvider>::waitCount(Connection<BUFFER, NetProvider> &conn,
307307
LOG_ERROR("Connection got an error: ", conn.getError().msg);
308308
return -1;
309309
}
310-
LOG_ERROR("Connection has been timed out: only ",
311-
conn.getFutureCount() - ready_futures, " are ready");
310+
LOG_DEBUG("Connection has been timed out: only ",
311+
conn.getFutureCount() - ready_futures, " are ready");
312312
return -1;
313313
}
314314

src/Client/LibevNetProvider.hpp

Lines changed: 1 addition & 1 deletion
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)