mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-07-22 11:51:04 +02:00
feat: limit campaign concurrency to number of CLIs
This commit is contained in:
parent
6711dcb3ea
commit
3cdede0f45
18 changed files with 846 additions and 462 deletions
|
|
@ -225,6 +225,7 @@ class RetryConfigResponse(BaseModel):
|
|||
|
||||
class CampaignLimitsResponse(BaseModel):
|
||||
concurrent_call_limit: int
|
||||
from_numbers_count: int
|
||||
default_retry_config: RetryConfigResponse
|
||||
|
||||
|
||||
|
|
@ -251,7 +252,21 @@ async def get_campaign_limits(user: UserModel = Depends(get_user)):
|
|||
except Exception:
|
||||
pass
|
||||
|
||||
# Get from_numbers count from telephony configuration
|
||||
from_numbers_count = 0
|
||||
try:
|
||||
telephony_config = await db_client.get_configuration(
|
||||
user.selected_organization_id,
|
||||
OrganizationConfigurationKey.TELEPHONY_CONFIGURATION.value,
|
||||
)
|
||||
if telephony_config and telephony_config.value:
|
||||
from_numbers = telephony_config.value.get("from_numbers", [])
|
||||
from_numbers_count = len(from_numbers)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return CampaignLimitsResponse(
|
||||
concurrent_call_limit=concurrent_limit,
|
||||
from_numbers_count=from_numbers_count,
|
||||
default_retry_config=RetryConfigResponse(**DEFAULT_CAMPAIGN_RETRY_CONFIG),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue