Feature Proposal: report progress writing to sockets

Abierto
#3,773 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

@reardonj ya está trabajando en esto.

Desde el 8/10/2026.

  • #3776 de @reardonj — abierto

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
45/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
scala
Área
networking

Línea de trabajo

Start by reading the Stream trait and locating the fs2 socket implementations that write incrementally. Review how default implementations can preserve bincompat and where each subclass would need an override; the work is done when socket writes report incremental progress through both proposed APIs.

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

Descripción

https://github.com/http4s/http4s/issues/7824 reports that spurious http4s timeouts occur writing very large chunks to a socket. The fs2 socket implementations (all?) actually write to the socket incrementally, but do not provide any indication to the caller that they are making progress.

This could take the form of two new methods on the Stream trait:

  /** Writes `bytes` to the peer, reporting as bytes are written.
    *
    * Completes when the bytes are written to the socket.
    */
  def writeProgress(bytes: Chunk[Byte]): Stream[F, Int] =
    Stream.eval(write(bytes)) >> Stream(bytes.size)

  /** Writes the supplied stream of bytes to this socket via `writeProgress` semantics.
    */
  def writesProgress: Pipe[F, Byte, Int] = s => s.chunks.flatMap(writeProgress)

By returning a stream of their progress, a caller can implement a timeout that only triggers if individual writes to the underlying socket take too long.

Unfortunately, default implementations must be provided to preserve bincompat. The writesProgress implementation would work in general, but writeProgress would need a useful override in each subclass to report incremental progress.

Lenguaje dominante
Scala
Estrellas
2.5k
Forks
633
Merge medio
3 d 21 h
PR fusionados (30 d)
13

Preparar el entorno

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 typelevel/fs2

Todos los issues de typelevel/fs2

Issues similares

Más issues de Scala

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.