Feature Request: Tracking # of HTTP requests made on the current TCP connection

Abierto
#266 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
ruby
Área
api, networking

Línea de trabajo

Comienza en lib/net/http.rb, en las ubicaciones referenciadas connect y begin_transport, y sigue cómo se establecen y reutilizan las conexiones persistentes. Verifica que el contador de solicitudes se restablezca cuando se crea una conexión TCP y se incremente después de los intentos de transporte, para que los llamadores puedan observar correctamente las solicitudes realizadas en la conexión actual.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

For persistent connections, some servers are configured to reset them after a certain number of HTTP requests. Net::HTTP::Persistent added a max_requests variable to preemptively close your connection after a certain amount of HTTP requests are made for this reason in https://github.com/drbrain/net-http-persistent/pull/42

However, without changes to Net::HTTP, Net::HTTP::Persistent can only track how many times it makes a request of it's Net::HTTP instance. But this isn't perfect: begin_transport can re-connect on a new TCP connection if it finds the socket was closed some time after the last time you used it, like if the server closed the connection, and Net::HTTP::Persistent will never know there's a new TCP connection, and that it should therefor reset its count of requests over the TCP connection back to 0.

My suggestion is that we make an instance variable here in Net::HTTP called @num_requests_on_connection, that gets set to 0 at the end of connect, and is incremented at the end of begin_transport after the reconnection attempts. I believe that way we could get an accurate count!

@raggi @drbrain

Lenguaje dominante
Ruby
Estrellas
148
Forks
95
Merge medio
10 h 54 min
PR fusionados (30 d)
4

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ruby/net-http

Todos los issues de ruby/net-http

Issues similares

Más issues de Ruby

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.