mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-07-25 12:01:04 +02:00
fix: increase concurrency limit an handle it across all call paths
This commit is contained in:
parent
d9b9a1efc8
commit
1a3f6ac09a
26 changed files with 1466 additions and 415 deletions
|
|
@ -7,6 +7,7 @@ idempotent, and the count only reaches zero when every registered run is gone.
|
|||
"""
|
||||
|
||||
import asyncio
|
||||
from unittest.mock import AsyncMock
|
||||
|
||||
import pytest
|
||||
from fastapi import FastAPI
|
||||
|
|
@ -91,6 +92,12 @@ async def test_run_pipeline_counts_call_during_setup(monkeypatch):
|
|||
"get_workflow_run",
|
||||
fake_get_workflow_run,
|
||||
)
|
||||
unregister_concurrency = AsyncMock()
|
||||
monkeypatch.setattr(
|
||||
run_pipeline_module.call_concurrency,
|
||||
"unregister_active_call",
|
||||
unregister_concurrency,
|
||||
)
|
||||
|
||||
task = asyncio.create_task(
|
||||
run_pipeline_module._run_pipeline(
|
||||
|
|
@ -108,6 +115,7 @@ async def test_run_pipeline_counts_call_during_setup(monkeypatch):
|
|||
with pytest.raises(RuntimeError, match="setup failed"):
|
||||
await asyncio.wait_for(task, timeout=1.0)
|
||||
assert active_calls.active_call_count() == 0
|
||||
unregister_concurrency.assert_awaited_once_with(42)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
@ -123,6 +131,12 @@ async def test_webrtc_entrypoint_counts_call_during_setup(monkeypatch):
|
|||
monkeypatch.setattr(
|
||||
run_pipeline_module.db_client, "get_workflow", fake_get_workflow
|
||||
)
|
||||
unregister_concurrency = AsyncMock()
|
||||
monkeypatch.setattr(
|
||||
run_pipeline_module.call_concurrency,
|
||||
"unregister_active_call",
|
||||
unregister_concurrency,
|
||||
)
|
||||
|
||||
task = asyncio.create_task(
|
||||
run_pipeline_module.run_pipeline_smallwebrtc(
|
||||
|
|
@ -140,6 +154,7 @@ async def test_webrtc_entrypoint_counts_call_during_setup(monkeypatch):
|
|||
with pytest.raises(RuntimeError, match="setup failed"):
|
||||
await asyncio.wait_for(task, timeout=1.0)
|
||||
assert active_calls.active_call_count() == 0
|
||||
unregister_concurrency.assert_awaited_once_with(43)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
@ -155,6 +170,12 @@ async def test_telephony_entrypoint_counts_call_during_setup(monkeypatch):
|
|||
monkeypatch.setattr(
|
||||
run_pipeline_module.db_client, "get_workflow", fake_get_workflow
|
||||
)
|
||||
unregister_concurrency = AsyncMock()
|
||||
monkeypatch.setattr(
|
||||
run_pipeline_module.call_concurrency,
|
||||
"unregister_active_call",
|
||||
unregister_concurrency,
|
||||
)
|
||||
|
||||
task = asyncio.create_task(
|
||||
run_pipeline_module.run_pipeline_telephony(
|
||||
|
|
@ -175,6 +196,7 @@ async def test_telephony_entrypoint_counts_call_during_setup(monkeypatch):
|
|||
with pytest.raises(RuntimeError, match="setup failed"):
|
||||
await asyncio.wait_for(task, timeout=1.0)
|
||||
assert active_calls.active_call_count() == 0
|
||||
unregister_concurrency.assert_awaited_once_with(44)
|
||||
|
||||
|
||||
def test_active_calls_route_requires_configured_secret(monkeypatch):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue