void shard_connection::fill_pipeline(void)
{
    struct timeval now;
    gettimeofday(&now, NULL);

    while (!m_conns_manager->finished() && m_pipeline->size() < m_config->pipeline) {
        if (!is_conn_setup_done()) {
            send_conn_setup_commands(now);
            return;
        }

        // don't exceed requests
        if (m_conns_manager->hold_pipeline(m_id))
            break;

        // client manage requests logic
        m_conns_manager->create_request(now, m_id);
    }
}
Beispiel #2
0
void client::fill_pipeline(void)
{
   
    while (!finished() && m_pipeline.size() < m_config->pipeline) {
        if (!is_conn_setup_done()) {
            send_conn_setup_commands();
            return;
        }

        // don't exceed requests
        if (m_config->requests > 0 && m_reqs_processed + m_pipeline.size() >= m_config->requests)
            break;

        // if we have reconnect_interval stop enlarging the pipeline
        // on time
        if (m_config->reconnect_interval) {
            if ((m_reqs_processed % m_config->reconnect_interval) + m_pipeline.size() >= m_config->reconnect_interval)
                return;
        }

        create_request();
    }
}