TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #425 · 20 апр.

Недавно делал быстрый прототип асинхронного приложения в котором требовалось вызывать много синхронного кода. Да, я знаю, что это не лучший дизайн, но нужно было быстрое решение на один процесс и без очередей. Поэтому я выполнял код в потоках. Выглядело это примерно так: from fastapi.concurrency import run_in_threadpool async def execute(data: DataRequest) -> DataResponse: try: result = await run_in_threadpool(sync_function, data) return DataResponse(data=result) except Exception as e: return DataResponse( error=str(e), success=False, ) В общем работает нормально. Для всех вызовов под капотом используется общий тредпул, всё работает предсказуемо. Но потребовалось изменить количество запускаемых в пуле потоков (по умолчанию создается 40 воркеров). Так как дело происходит с FastAPI, делается это через lifespan используя настройки anyio: import anyio @asynccontextmanager async def lifespan(app: FastAPI): limiter = anyio.to_thread.current_default_thread_limiter() limiter.total_tokens = 100 yield # если вдруг нужно вернуть обратно limiter.total_tokens = 40 Зачем менять количество воркеров? - уменьшить, если оперативки мало (один тред занимает ~8мб) - увеличить чтобы выдержать нагрузку Если есть предложения получше при тех же вводных - предлагайте😉 #async

Hashtags

Резултати

Пронајдени 2 слични објави

Пребарај: #strive

当前筛选 #strive清除筛选
Venture Village Wall 🦄

@venturevillagewall · Post #3723 · 26.12.2024 г., 22:00

New Bitcoin Bond ETF Announced! Vivek Ramaswamy’s Strive Asset Management has filed for a Bitcoin Bond ETF, allowing regular investors access to convertible bonds linked to companies holding Bitcoin treasuries. 📈 In other updates, Curve's EYWA protocol secured undisclosed strategic funding from Kenetic, Michael Egorov, and Anton Bukov. Also, ChainOpera AI raised $17M in seed funding, led by Finality Capital and others. Lastly, the vote to use Blackrock's $BUIDL as backing for the new Frax USD stablecoin is live, encouraging community engagement in its development. For more details, check out the updates: Frax USD Voting and Aave-Polygon Relationship. #Bitcoin#ETF#Crypto#Aave#Polygon#Strive#Curve#EYWA#ChainOpera#AI#Investment#Funding#Startups#Frax#Stablecoin#VivekRamaswamy#Blackrock#VC#Tech

Crypto M - Crypto News

@CryptoM · Post #64767 · 09.04.2026 г., 20:52

🚀 Analyst Lance Vitanza Initiates Buy Ratings on Three Treasury Companies Lance Vitanza from TD Cowen has initiated coverage on Nakamoto, SharpLink Gaming, and Strive with Buy ratings. According to NS3.AI, Vitanza has set price targets of $1, $16, and $26 for these companies, respectively. He suggests that these treasury firms have the potential to outperform spot crypto exchange-traded products, provided that cryptocurrency prices recover and the companies continue to increase their token holdings per share. #LanceVitanza#TD Cowen #Nakamoto#SharpLinkGaming#Strive#BuyRating#TreasuryCompanies#Crypto#TokenHoldings#PriceTargets#BTC