Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions shard_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ shard_connection::shard_connection(unsigned int id, connections_manager* conns_m
struct event_base* event_base, abstract_protocol* abs_protocol) :
m_address(NULL), m_port(NULL), m_unix_sockaddr(NULL),
m_bev(NULL), m_request_per_cur_interval(0), m_pending_resp(0), m_connection_state(conn_disconnected),
m_hello(setup_done), m_authentication(setup_done), m_db_selection(setup_done), m_cluster_slots(setup_done) {
m_hello(setup_done), m_authentication(setup_done), m_db_selection(setup_done), m_cluster_slots(setup_done), m_event_timer(NULL) {
m_id = id;
m_conns_manager = conns_man;
m_config = config;
Expand Down Expand Up @@ -553,7 +553,7 @@ void shard_connection::handle_event(short events)
m_connection_state = conn_connected;
bufferevent_enable(m_bev, EV_READ|EV_WRITE);

if (!m_conns_manager->get_reqs_processed()) {
if (m_event_timer == NULL) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reconnection calls wrong function when rate limiting disabled

Medium Severity

When request_rate is 0 (rate limiting disabled), m_event_timer is never assigned, so the condition m_event_timer == NULL remains true even on reconnection. This causes process_first_request() to be called instead of fill_pipeline(), incorrectly resetting the benchmark start time via set_start_time(). The original condition !get_reqs_processed() correctly distinguished first connection from reconnection regardless of rate limiting configuration.

Fix in Cursor Fix in Web

/* Set timer for request rate */
if (m_config->request_rate) {
struct timeval interval = { 0, (int)m_config->request_interval_microsecond };
Expand Down