From f996ded11c86201767981e7c6c4abf42364af418 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Wed, 17 Dec 2025 14:24:19 +0000 Subject: [PATCH] re made appointments --- backend/src/dashboard/scripts/hubspot_to_s3.py | 2 +- .../dashboard/scripts/hubspot_to_s3_sales_forecast.py | 2 +- backend/src/dashboard/services/hubspot_client_async.py | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/src/dashboard/scripts/hubspot_to_s3.py b/backend/src/dashboard/scripts/hubspot_to_s3.py index 1feebf0..5f811fc 100644 --- a/backend/src/dashboard/scripts/hubspot_to_s3.py +++ b/backend/src/dashboard/scripts/hubspot_to_s3.py @@ -52,7 +52,7 @@ async def main(): await queue.put(deal_id) # PROPER concurrency — same as semaphore limit - NUM_WORKERS = 10 + NUM_WORKERS = 5 pbar = tqdm(total=total, desc="Fetching Deals", unit="deal", dynamic_ncols=True) diff --git a/backend/src/dashboard/scripts/hubspot_to_s3_sales_forecast.py b/backend/src/dashboard/scripts/hubspot_to_s3_sales_forecast.py index 8dadb23..ed4c2f6 100644 --- a/backend/src/dashboard/scripts/hubspot_to_s3_sales_forecast.py +++ b/backend/src/dashboard/scripts/hubspot_to_s3_sales_forecast.py @@ -56,7 +56,7 @@ async def main(): await queue.put(deal_id) # PROPER concurrency — same as semaphore limit - NUM_WORKERS = 10 + NUM_WORKERS = 5 pbar = tqdm(total=total, desc="Fetching Deals", unit="deal", dynamic_ncols=True) diff --git a/backend/src/dashboard/services/hubspot_client_async.py b/backend/src/dashboard/services/hubspot_client_async.py index 0d2e2fd..574d050 100644 --- a/backend/src/dashboard/services/hubspot_client_async.py +++ b/backend/src/dashboard/services/hubspot_client_async.py @@ -7,10 +7,10 @@ import random class HubSpotClientAsync: - API_CONCURRENCY = asyncio.Semaphore(10) # globally limit concurrency + API_CONCURRENCY = asyncio.Semaphore(5) # globally limit concurrency RATE_LIMIT_DELAY = 0.25 # 4 requests/sec → safe - BASE_BACKOFF = 0.5 # seconds - MAX_BACKOFF = 10.0 # cap sleep + BASE_BACKOFF = 10.00 # secon + MIN_BACKOFF = 10.00 # cap sle MAX_RETRIES = 5 @@ -54,7 +54,7 @@ class HubSpotClientAsync: self.MAX_BACKOFF, self.BASE_BACKOFF * (2 ** (attempt - 1)) ) - jitter = random.uniform(0, backoff) + jitter = random.uniform(10, 10 + backoff) self.logger.warning( f"HubSpot retry {attempt}/{self.MAX_RETRIES} " @@ -298,7 +298,7 @@ class HubSpotClientAsync: "deals", deal_id, "line_items", - limit=100, + limit=10, ) if not response.results: