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

Резултати

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

Пребарај: #d3vxr

当前筛选 #d3vxr清除筛选
D3VXR verified

@d3vxrverified · Post #61 · 15.04.2026 г., 16:27

Welcome to the D3VXR Arcade 🎮⚡ Featuring Lucky Block Rush: Pick blocks. Stack points. Push your luck. But one wrong move… 💥 BUST. Risk vs reward at its best. #D3VXR#GameFi

D3VXR verified

@d3vxrverified · Post #16 · 23.05.2025 г., 16:13

The building never stops. 🔧⚡️ At D3VXR.app, every update pushes us closer to a seamless GameFi world. 🔁 Powered by $DGXR — where games, tokens, and player ownership collide. Web3 isn't waiting. We’re building it. #D3VXR#GameFi#Solana#Web3Gaming

D3VXR verified

@d3vxrverified · Post #21 · 27.05.2025 г., 00:42

🚨 GameFi is changing — and D3VXR.app is at the center of it. 🎮 We’re not just building a game. We’re building a Web3-powered ecosystem where you can: ⚔️ Play PvP 💰 Stake and Earn 🎲 Compete with real rewards 🔗 Powered by $DGXR on Solana 🔍 Want to understand the vision? Read more: https://d3vxr.app/about This is just the beginning. Let’s shape the future of GameFi together. 🌐🔥 #D3VXR#DGXR#GameFi#Solana#Web3Gaming

D3VXR verified

@d3vxrverified · Post #17 · 24.05.2025 г., 21:29

A game on d3vxr.app platform loading... Sol Dice Wars Update Incoming! ⚔️🎲 The battlefield is nearly complete... ✅ Lobby creation ✅ Turn-based dice rolls ✅ PvP attacks + expressions ✅ Buffs in effect ⚒️ Card system, nearly forged This isn't just a game — it's strategy on-chain. 👀 Preview the chaos. #D3VXR#SolDiceWars#GameFi#Web3Gaming#GAMEFI#crypto#web3

D3VXR verified

@d3vxrverified · Post #24 · 30.05.2025 г., 02:50

🔑 Utility is what separates real projects from the noise. $DGXR is more than a token — it's the engine behind the D3VXR platform. From games to crypto activities, every feature has a purpose. D3VXR isn’t here to ride hype. It’s here to build useful Web3 experiences on Solana. Check it out: https://d3vxr.app #DGXR#D3VXR#CryptoUtility#Solana#Web3Gaming

D3VXR verified

@d3vxrverified · Post #23 · 29.05.2025 г., 04:08

🚀 The Power of Utility-Driven Tokens: Why $DGXR Matters In a sea of hype tokens, $DGXR stands apart — because it’s built for real use, real players, and real rewards. 🎮D3VXR.app is more than a platform. It’s a living Web3 gaming ecosystem where: ✅ Every $DGXR token gives you access to games and challenges ✅ Win battles, earn more $DGXR — use it, don’t just hold it ✅ Buy, trade, and level up NFTs with actual in-game value ✅ Shape the future — $DGXR gives you power in the ecosystem ⚡️ This isn’t speculation. It’s participation. D3VXR is designed from the ground up to reward time, skill, and strategy — powered by $DGXR. 👉 Dive in: https://d3vxr.app 🔗 Join the revolution. Play to earn, not just to play. #D3VXR#DGXR#Web3Gaming#GameFi#Solana#UtilityToken