From 8dee2e88a5e4de0201f1ae99a7f7cb73bea3e0b0 Mon Sep 17 00:00:00 2001 From: Victor A <33580233+victoray@users.noreply.github.com> Date: Tue, 9 Apr 2024 10:58:08 +0300 Subject: [PATCH] FRIDGE-1084 Change default concurrency limit (#517) * fix: change default concurrency to 10 * chore: update readme * chore: changesets --- .changeset/sour-goats-help.md | 6 ++++++ packages/plugin-serverless/README.md | 4 ++-- packages/serverless-api/src/api/utils/http_config.ts | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .changeset/sour-goats-help.md diff --git a/.changeset/sour-goats-help.md b/.changeset/sour-goats-help.md new file mode 100644 index 00000000..9d4b2eb6 --- /dev/null +++ b/.changeset/sour-goats-help.md @@ -0,0 +1,6 @@ +--- +'@twilio-labs/plugin-serverless': patch +'@twilio-labs/serverless-api': patch +--- + +Change default concurrency limit from 50 to 10 diff --git a/packages/plugin-serverless/README.md b/packages/plugin-serverless/README.md index e2c9421a..e73b1c5d 100644 --- a/packages/plugin-serverless/README.md +++ b/packages/plugin-serverless/README.md @@ -43,8 +43,8 @@ USAGE ### Concurrency When deploying lots of Functions and Assets it is possible to run up against the enforced concurrency limits of the Twilio API. You can limit the concurrency and set how many times the library retries API requests using environment variables. - -The default concurrency is 50 and the default number of retries is 10. You can change this by setting environment variables. The following would set concurrency to 1, only 1 live request at a time, and retries to 0, so if it fails it won't retry. +It is advisable to keep the concurrency low (around 10-15) to avoid hitting the rate limits of the Twilio API. +The default concurrency is 10 and the default number of retries is 10. You can change this by setting environment variables. The following would set concurrency to 1, only 1 live request at a time, and retries to 0, so if it fails it won't retry. ```sh-session export TWILIO_SERVERLESS_API_CONCURRENCY=1 diff --git a/packages/serverless-api/src/api/utils/http_config.ts b/packages/serverless-api/src/api/utils/http_config.ts index f365a2d1..96bcca06 100644 --- a/packages/serverless-api/src/api/utils/http_config.ts +++ b/packages/serverless-api/src/api/utils/http_config.ts @@ -5,7 +5,7 @@ if (typeof retryLimit === 'undefined') { let concurrency = process.env.TWILIO_SERVERLESS_API_CONCURRENCY; if (typeof concurrency === 'undefined') { - concurrency = '50'; + concurrency = '10'; } export const RETRY_LIMIT = parseInt(retryLimit, 10);