firebase / firebase/firebase-functions-python
Async support
- Ngôn ngữ chính
- Python
- Star
- 167
- Fork
- 34
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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/
Hướng dẫn đóng góp
Hướng nghiên cứu
Không có tệp mã nguồn, bài kiểm thử hoặc điểm vào nào được nêu tên. Hãy bắt đầu bằng cách lập bản đồ các điểm vào của trình xử lý sự kiện đồng bộ hiện tại và xem xét công việc bất đồng bộ được trích dẫn của Starlette và firebase-admin-python. Được coi là hoàn thành khi đã xác định mô hình trình xử lý bất đồng bộ, tích hợp mô hình đó vào runtime và lập tài liệu về phạm vi bao phủ cho các trường hợp sử dụng tuần tự và đồng thời được mô tả.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- backend, cloud
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100