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 слични објави

Пребарај: #gemifaucet

当前筛选 #gemifaucet清除筛选
Gemi Faucet News

@gemifaucet · Post #1577 · 05.05.2026 г., 06:06

🎯Big Opportunity: Turn 2 TON into 100 TON!💰 Get ready to test your luck with our latest Lottery Draw on Gemifaucet! 🎟Ticket Price: Only 2 TON 🏆Winning Prize: Up to 100 TON ⏳Draw Time: Every 3 Days Here’s your chance to multiply your TON in a simple and exciting way. Just grab your ticket, sit back, and wait for the draw — one lucky winner will walk away with a massive reward! 🔥 Don’t miss out — the sooner you enter, the bigger the prize pool grows. 🚀Buy your ticket now and secure your chance to win big! #Gemifaucet#Lottery#WinTON#CryptoOpportunity Buy Now

Gemi Faucet News

@gemifaucet · Post #1573 · 04.05.2026 г., 18:47

🎉Exciting Update: Lottery Feature is Now Live on Gemifaucet!🎉 We’re thrilled to introduce a brand-new way to win big on Gemifaucet — our Lottery System is officially launched! 🎟How it works: * Purchase your lottery tickets directly داخل the app * Each ticket gives you a chance to win * One lucky winner takes home the entire prize pool💰 🔥 The more participants, the bigger the rewards — so don’t miss your chance to be part of it! This feature is designed to make your experience more engaging, rewarding, and fun. Whether you're a regular user or just getting started, now is the perfect time to try your luck. 🚀Start buying your tickets today and aim for the jackpot! Stay tuned for more updates and features coming soon. #Gemifaucet#LotteryLaunch#WinBig#CryptoRewards

Gemi Faucet News

@gemifaucet · Post #771 · 10.02.2026 г., 07:09

💥 OFFICIAL PARTNERSHIP ANNOUNCEMENT 💥 We’re pleased to announce an official partnership between Gemifaucet and AdsGram, focused on improving monetization quality and user experience across our platform. 🚀 About Gemifaucet Gemifaucet is a Telegram mini app where users receive rewards by interacting with tasks and ads in a simple, transparent, and user-friendly environment. 📊 About AdsGram AdsGram is a leading Telegram Native Ads platform trusted by top Telegram apps and communities. It provides seamless, non-intrusive ad solutions with strong performance, advanced analytics, and a proven monetization ecosystem. 🤝 Why this partnership matters By this official partnership formalizes our collaboration and strengthens our monetization infrastructure. 👉 Gemifaucet: @gemifaucet_bot 👉 AdsGram: @adsgram_ai Thank you for your continued support — more updates coming soon! 🚀 #OfficialPartnership#Gemifaucet#AdsGram#TelegramMiniApp#Announcement