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

Резултати

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

Пребарај: #cryptopresale

当前筛选 #cryptopresale清除筛选
Crypto Fight || News 🚀

@cryptofightnews · Post #2968 · 07.10.2025 г., 18:54

2 DAYS UNTIL PRESALE! 🚨 The wait is almost over, Vern! 😎 $HVN Presale goes LIVE in just 2 days — and the community is gearing up for something BIG! 💥 🎯 Don’t miss your chance to get in early 🎙️ AMA coming soon 📍Join the Telegram: t.me/heyverntoken Let’s make history, Hey Vern style! 🧢💰 #HeyVernToken#CryptoPresale#Memecoin#Polygon#HVN

🚀🚀The intelligent investors💯💯

@the_intelligent_investors · Post #1632 · 01.02.2025 г., 08:34

🚀 Blockchain Energy is LIVE! 🔥 The world’s first physical blockchain product is here—introducing Blockchain Energy! 💥 Our website and ICO are officially LIVE, and early buyers can now purchase BET tokens at. www.blockchainenergy.co.uk. 💰 Buy early before prices increase! Price alerts and community updates will be shared exclusively on our Telegram group – join now: https://t.me/+vLcj22SyWvY2ZDg0 🔗 Powering the future of blockchain with real-world energy! #BlockchainEnergy#BETToken#CryptoLaunch#ICO#BlockchainRevolution#CryptoCommunity#Web3#CryptoInvesting#TokenSale#CryptoPresale

Crypto Fight || News 🚀

@cryptofightnews · Post #3162 · 16.12.2025 г., 15:37

🔥MegaBase ($MGBS) 🚀The Future of Community-Driven Wealth is Here — MegaBase ($MGBS) is on a bold mission to build real value and empower collective success. We’re not just another crypto project — we’re creating a sustainable ecosystem where the community truly wins. 📨Every $MGBS transaction fuels more than just our token growth, it creates a global impact. 🚨Small percentage of the transaction fees goes to charitable causes chosen by the community.✅ ✅Earn rewards ✅Auto-burn ✅Milestone Giveaway ✅Auto Liquidity ✅Progressive Protection Protocol ✅Ecosystem engineered for Continous Development 📌Ca: 0x481ef7Ff561d9a2a892553ba930A6365f911E0bb 🔥Dex: https://dexscreener.com/base/0xe348135151c3bFF2bcaB2a9F7A571e7214edc6A8 ⬇️ Social links 🔥 Telegram: https://t.me/+IQ696SfodDQwOTEx 🔥 Website: https://megabasecoin.com 🔥 X (Twitter): https://x.com/megabasecoin 🍏🍏🍏🍏 🚀AMA Today with Crypto Panda on Binance Space 🐼🎙 🔜 2:00 PM ET 🎁 Active Launch Giveaway running till 31st December 2025! Join our Telegram for full details or check our X page to participate. #MegaBase#MGBS#CryptoPresale#DeFi#Web3#Blockchain#CommunityWealth#Crypto#Base#Coinbase#Bullrun#Bitcoin#Bullish#Ethereum#DEX#C