firebase / firebase/firebase-functions-python

Async support

Ouverte
#135 17 commentaires 10 réactions 0 personnes assignées Voir sur GitHub
feature-request
Langage dominant
Python
Étoiles
167
Forks
34
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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/

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Aucun fichier source, test ou point d’entrée n’est nommé. Commencez par cartographier les points d’entrée actuels des gestionnaires d’événements synchrones et examiner le travail asynchrone cité concernant Starlette et firebase-admin-python. La tâche est considérée comme terminée lorsqu’un modèle de gestionnaires asynchrones est défini, que son intégration au runtime est réalisée et que la couverture des cas d’utilisation séquentiels et concurrents décrits est documentée.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
backend, cloud
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
Calme
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.