Skip to content

[Bug] Synchronous requests.post() blocks async event loop in Slack notification functions #631

@rohansx

Description

@rohansx

Bug

Two async functions use the synchronous requests.post() from the requests library, which blocks the FastAPI async event loop during execution:

  1. app/modules/auth/auth_router.py:56-59send_slack_message():

    async def send_slack_message(message: str):
        payload = {"text": message}
        if SLACK_WEBHOOK_URL:
            requests.post(SLACK_WEBHOOK_URL, json=payload)  # blocks event loop
  2. app/modules/utils/parse_webhook_helper.py:11-23send_slack_notification():

    async def send_slack_notification(self, project_id, error_msg=None):
        ...
        response = requests.post(self.url, ...)  # blocks event loop

Neither call sets a timeout, so if Slack is unreachable the call can hang indefinitely.

Impact

When Slack is slow or unreachable, the synchronous HTTP call blocks the entire async event loop, stalling all concurrent requests until the call completes or the OS-level TCP timeout is reached.

Expected behavior

Async functions should use an async HTTP client (httpx.AsyncClient, which is already a project dependency) with a reasonable timeout.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions