firebase / firebase/firebase-functions-python

Async support

Abierto
#135 17 comentarios 10 reacciones 0 asignados Ver en GitHub
feature-request
Lenguaje dominante
Python
Estrellas
167
Forks
34
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Would it make sense to support async functions here, so that the event handlers could be called in an async manner and consequently call async libraries?

This way a single instance could be handling more requests in parallel, for example if the cloud function calls several external APIs in a sequence to complete a process, and spends most of the time just waiting for responses, and uses only a little memory and CPU in general.

It is possible to call async code from the current sync functions, but it does not help with scalability, as the cloud function itself still blocks during the whole operation. This can help to do things in parallel in a cloud function, but not with sequential operations, which are common at least in our use case.

The original JS runtime is async, like all things Node, but also Python has standard async in version 3. Consequently, firebase-admin-python has worked on adding async support, since google-auth added async support in 2021. https://github.com/firebase/firebase-admin-python/issues/104

> Hey Folks, We just released [v5.3.0](https://github.com/firebase/firebase-admin-python/releases/tag/v5.3.0) which added async support for the Cloud Firestore API. This is the first step into fulfilling this FR so please give it a try and let us know what you think!

Starlette is a popular, lightweight ASGI framework which could maybe used for this, the same way Flask is for the sync version? https://www.starlette.io/

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

No se nombran archivos fuente, pruebas ni puntos de entrada. Empieza por mapear los puntos de entrada actuales de los manejadores de eventos síncronos y revisar el trabajo asíncrono citado de Starlette y firebase-admin-python. Se considera completado cuando haya un modelo definido de manejadores asíncronos, su integración en el runtime y una cobertura documentada de los casos de uso secuenciales y concurrentes descritos.

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

Evaluación

Stack tecnológico
python
Área
backend, cloud
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Tranquilo
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.