mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2025-08-06 13:19:47 +00:00
Silence verbose feedback from commands sent to Redis.
This commit is contained in:
parent
853fb13495
commit
960f10c370
1 changed files with 14 additions and 1 deletions
|
@ -26,9 +26,14 @@
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <iostream>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
//#define VERBOSE_HIREDIS_COMM
|
||||||
|
|
||||||
|
#if defined(VERBOSE_HIREDIS_COMM)
|
||||||
|
# include <iostream>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace redis {
|
namespace redis {
|
||||||
namespace {
|
namespace {
|
||||||
const std::size_t g_max_redis_unanswered_commands = 1000;
|
const std::size_t g_max_redis_unanswered_commands = 1000;
|
||||||
|
@ -147,13 +152,19 @@ namespace redis {
|
||||||
const auto pending_futures = m_local_data->pending_futures.fetch_add(1);
|
const auto pending_futures = m_local_data->pending_futures.fetch_add(1);
|
||||||
auto* data = new HiredisCallbackData(m_local_data->pending_futures, m_local_data->free_cmd_slot);
|
auto* data = new HiredisCallbackData(m_local_data->pending_futures, m_local_data->free_cmd_slot);
|
||||||
|
|
||||||
|
#if defined(VERBOSE_HIREDIS_COMM)
|
||||||
std::cout << "run_pvt(), " << pending_futures << " items pending... ";
|
std::cout << "run_pvt(), " << pending_futures << " items pending... ";
|
||||||
|
#endif
|
||||||
if (pending_futures >= g_max_redis_unanswered_commands) {
|
if (pending_futures >= g_max_redis_unanswered_commands) {
|
||||||
|
#if defined(VERBOSE_HIREDIS_COMM)
|
||||||
std::cout << " waiting... ";
|
std::cout << " waiting... ";
|
||||||
|
#endif
|
||||||
std::unique_lock<std::mutex> u_lock(m_local_data->futures_mutex);
|
std::unique_lock<std::mutex> u_lock(m_local_data->futures_mutex);
|
||||||
m_local_data->free_cmd_slot.wait(u_lock, [this]() { return m_local_data->pending_futures < g_max_redis_unanswered_commands; });
|
m_local_data->free_cmd_slot.wait(u_lock, [this]() { return m_local_data->pending_futures < g_max_redis_unanswered_commands; });
|
||||||
}
|
}
|
||||||
|
#if defined(VERBOSE_HIREDIS_COMM)
|
||||||
std::cout << " emplace_back(future)... ";
|
std::cout << " emplace_back(future)... ";
|
||||||
|
#endif
|
||||||
|
|
||||||
m_futures.emplace_back(data->promise.get_future());
|
m_futures.emplace_back(data->promise.get_future());
|
||||||
{
|
{
|
||||||
|
@ -163,7 +174,9 @@ namespace redis {
|
||||||
static_cast<void>(command_added);
|
static_cast<void>(command_added);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(VERBOSE_HIREDIS_COMM)
|
||||||
std::cout << "command sent to hiredis" << std::endl;
|
std::cout << "command sent to hiredis" << std::endl;
|
||||||
|
#endif
|
||||||
m_async_conn->wakeup_event_thread();
|
m_async_conn->wakeup_event_thread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue