ntls-io / nautilus-wallet

Nautilus Wallet
GNU Affero General Public License v3.0
8 stars 4 forks source link

fix(backend-services): use sync Twilio API call in executor #568

Closed billguo99 closed 1 year ago

billguo99 commented 1 year ago

Fix did not work: https://github.com/ntls-io/nautilus-wallet/pull/567/files

From https://www.twilio.com/blog/send-sms-fastapi-twilio:

The problem is that the Twilio helper library for Python does not support asynchronous applications. Since this library will be making network requests to Twilio servers, it will block the loop if used directly in the asynchronous function. To avoid this problem, we’ll encapsulate all the Twilio related work in a function that we’ll call send_sms(), and we’ll execute this function inside an [executor](https://docs.python.org/3/library/asyncio-eventloop.html#executing-code-in-thread-or-process-pools) to keep the async application running smoothly.

From https://www.twilio.com/blog/twilio-python-helper-library-async: Using Solution #3 - Using a thread executor

netlify[bot] commented 1 year ago

Deploy Preview for nautilus-wallet-staging canceled.

Name Link
Latest commit ae20671ca2a396d60ce608617b50b118014e3256
Latest deploy log https://app.netlify.com/sites/nautilus-wallet-staging/deploys/646c67b93d057900084a4cc0
codecov-commenter commented 1 year ago

Codecov Report

Merging #568 (ae20671) into main (76f7244) will not change coverage. The diff coverage is n/a.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@           Coverage Diff           @@
##             main     #568   +/-   ##
=======================================
  Coverage   46.92%   46.92%           
=======================================
  Files         173      173           
  Lines        2828     2828           
  Branches      546      546           
=======================================
  Hits         1327     1327           
  Misses       1501     1501