From 5daf1b930ea149319f7603465bfdf33c0b135393 Mon Sep 17 00:00:00 2001 From: Robert Szefler Date: Mon, 24 Jun 2024 16:02:49 +0200 Subject: [PATCH] Configurable slack request timeout (#1464) Co-authored-by: arik --- src/robusta/core/model/env_vars.py | 1 + src/robusta/integrations/slack/sender.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/robusta/core/model/env_vars.py b/src/robusta/core/model/env_vars.py index 571bf80ae..d5b49df2a 100644 --- a/src/robusta/core/model/env_vars.py +++ b/src/robusta/core/model/env_vars.py @@ -69,6 +69,7 @@ def load_bool(env_var, default: bool): TELEMETRY_PERIODIC_SEC = int(os.environ.get("TELEMETRY_PERIODIC_SEC", 60 * 60 * 24)) # 24H +SLACK_REQUEST_TIMEOUT = int(os.environ.get("SLACK_REQUEST_TIMEOUT", 90)) SLACK_TABLE_COLUMNS_LIMIT = int(os.environ.get("SLACK_TABLE_COLUMNS_LIMIT", 3)) DISCORD_TABLE_COLUMNS_LIMIT = int(os.environ.get("DISCORD_TABLE_COLUMNS_LIMIT", 4)) RSA_KEYS_PATH = os.environ.get("RSA_KEYS_PATH", "/etc/robusta/auth") diff --git a/src/robusta/integrations/slack/sender.py b/src/robusta/integrations/slack/sender.py index d580bcf21..52f953837 100644 --- a/src/robusta/integrations/slack/sender.py +++ b/src/robusta/integrations/slack/sender.py @@ -12,7 +12,7 @@ from slack_sdk.errors import SlackApiError from robusta.core.model.base_params import AIInvestigateParams, ResourceInfo -from robusta.core.model.env_vars import ADDITIONAL_CERTIFICATE, HOLMES_ENABLED, SLACK_TABLE_COLUMNS_LIMIT +from robusta.core.model.env_vars import ADDITIONAL_CERTIFICATE, SLACK_REQUEST_TIMEOUT, HOLMES_ENABLED, SLACK_TABLE_COLUMNS_LIMIT from robusta.core.playbooks.internal.ai_integration import ask_holmes from robusta.core.reporting.base import Emojis, EnrichmentType, Finding, FindingStatus from robusta.core.reporting.blocks import ( @@ -61,7 +61,7 @@ def __init__(self, slack_token: str, account_id: str, cluster_name: str, signing except Exception as e: logging.exception(f"Failed to use custom certificate. {e}") - self.slack_client = WebClient(token=slack_token, ssl=ssl_context) + self.slack_client = WebClient(token=slack_token, ssl=ssl_context, timeout=SLACK_REQUEST_TIMEOUT) self.signing_key = signing_key self.account_id = account_id self.cluster_name = cluster_name