From d9e606d4eaa7c12bcf55e95e04a3cb916e020436 Mon Sep 17 00:00:00 2001 From: Abhimanyu Babbar Date: Mon, 26 Feb 2024 16:11:50 +0530 Subject: [PATCH] start capturing max concurrent workers in env to the service --- src/util/openfaas/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/util/openfaas/index.js b/src/util/openfaas/index.js index 878fa706d9..0fe3084b1f 100644 --- a/src/util/openfaas/index.js +++ b/src/util/openfaas/index.js @@ -11,6 +11,7 @@ const stats = require('../stats'); const { getMetadata, getTransformationMetadata } = require('../../v0/util'); const { HTTP_STATUS_CODES } = require('../../v0/util/constant'); +const FAAS_MAX_CONCURRENT_WORKERS = process.env.FAAS_MAX_CONCURRENT_WORKERS || '1'; const FAAS_BASE_IMG = process.env.FAAS_BASE_IMG || 'rudderlabs/openfaas-flask:main'; const FAAS_MAX_PODS_IN_TEXT = process.env.FAAS_MAX_PODS_IN_TEXT || '40'; const FAAS_MIN_PODS_IN_TEXT = process.env.FAAS_MIN_PODS_IN_TEXT || '1'; @@ -135,7 +136,10 @@ const deployFaasFunction = async ( envProcess = `${envProcess} --code "${code}" --config-backend-url ${CONFIG_BACKEND_URL} --lvids "${lvidsString}"`; } - const envVars = {}; + const envVars = { + max_concurrent_workers: FAAS_MAX_CONCURRENT_WORKERS, + }; + if (FAAS_ENABLE_WATCHDOG_ENV_VARS.trim().toLowerCase() === 'true') { envVars.max_inflight = FAAS_MAX_INFLIGHT; envVars.exec_timeout = FAAS_EXEC_TIMEOUT;