diff --git a/app/cron_corporate_lobbying.py b/app/cron_corporate_lobbying.py index b98eca6..e06d3a0 100644 --- a/app/cron_corporate_lobbying.py +++ b/app/cron_corporate_lobbying.py @@ -385,10 +385,10 @@ def create_dataset(): print(f"Total stocks: {len(stock_data)}") con.close() - batch_size = 10 + batch_size = 3 stock_batches = [stock_data[i:i+batch_size] for i in range(0, len(stock_data), batch_size)] - with concurrent.futures.ProcessPoolExecutor(max_workers=os.cpu_count()) as executor: + with concurrent.futures.ProcessPoolExecutor(max_workers=4) as executor: futures = [executor.submit(process_stocks_batch, batch, csv_files, reports_folder, threshold) for batch in stock_batches] for future in concurrent.futures.as_completed(futures): diff --git a/app/main.py b/app/main.py index 1b5e596..95d2210 100755 --- a/app/main.py +++ b/app/main.py @@ -2815,15 +2815,15 @@ async def get_government_contract(data:TickerData, api_key: str = Security(get_a redis_client.expire(cache_key, 3600*3600) # Set cache expiration time to 1 day return res -@app.post("/lobbying") +@app.post("/corporate-lobbying") async def get_lobbying(data:TickerData, api_key: str = Security(get_api_key)): ticker = data.ticker.upper() - cache_key = f"lobbying-{ticker}" + cache_key = f"corporate-lobbying-{ticker}" cached_result = redis_client.get(cache_key) if cached_result: return orjson.loads(cached_result) try: - with open(f"json/lobbying/{ticker}.json", 'rb') as file: + with open(f"json/corporate-lobbying/companies/{ticker}.json", 'rb') as file: res = orjson.loads(file.read()) except: res = []