Consider adding close_connections argument to serve

Abierto
#1,756 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Activo
Stack tecnológico
python

Línea de trabajo

Start by comparing the asyncio, threading, and trio serve implementations with their close, shutdown, and aclose methods. Decide whether serve should gain close_connections, close_code, and close_reason or whether documentation should show the recommended pattern; done means the chosen behavior is consistently implemented or documented across all three implementations.

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

Descripción

documentation

The close / shutdown / aclose methods of servers (in asyncio / threading / trio implementations) take a close_connections argument to control whether the server should close connections proactively (the default behavior) or wait for clients to disconnect by themselves (which could be arbitrarily long).

When using serve as a context manager, there is no way to control this behavior. An obvious option would consist in adding a close_connections argument to serve, then proxy it to close / shutdown / aclose in __aexit__ / __exit__ / __aexit__.

If we do this, for completeness, we should also add close_code and close_reason. This means adding three arguments to serve. I'm not convinced that it's a good trade-off.

An alternative would consist in documenting the recommended pattern for controlling this behavior. Currently, the trio implementation shows an example of using aclose which can easily be extended with some parameter. The asyncio and threading implementations don't show examples of using close and shutdown.

Lenguaje dominante
Python
Estrellas
5.7k
Forks
613
Merge medio
23 h 5 min
PR fusionados (30 d)
9

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 python-websockets/websockets

Todos los issues de python-websockets/websockets

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.