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

Пребарај: #binanceaipro

当前筛选 #binanceaipro清除筛选
币安公告

@binance_cn · Post #6576 · 01.04.2026 г., 12:00

🔥 新手学堂全新系列「学堂加油站」正式开站! 紧跟热点 × 实操导向 × 保姆级教程 不讲废话,只给你真正用得上的交易知识📚 🚀BNB 实战 · 6天特训 第一期:让 AI 成为你的交易助手 6 篇保姆级教程带你玩转 #BinanceAiPro 与 AI Agent Skills ✅ 让 AI 替你盯盘 ✅ 让 AI 帮你搜料 ✅ 让 AI 辅助你做决策 关注 @新手学堂天使自治社区,第一时间获取更新 https://www.binance.com/zh-CN/square/profile/xuetang

Crypto kanishk chaudhary public group🌍

@cryptokanishkchaudharypremium · Post #15823 · 27.04.2026 г., 04:36

🚀 Binance AI Pro is changing how we actually trade. No more jumping between 10 tools. No more spending hours on research just to miss the move. With Binance AI Pro you speak naturally → AI researches, builds strategy, executes trades, and monitors 24/7 — all in one place. Key Highlights: • 68.69% of AI actions are real execution commands (placing & managing orders) • 35.2% of user intent is direct trade execution & strategy (2x any other category) • 45.7% of sessions are system-triggered — AI works even when you're not prompting it This isn't another chatbot giving signals. This is an AI execution engine running on a dedicated sub-account with zero withdrawal rights. You control the capital and strategy. AI executes. Binance just compressed the entire trading workflow (research → strategy → execution → monitoring) from hours to minutes. If you're an active trader, this is the real shift we've been waiting for. Try Binance AI Pro → https://www.binance.com/en/ai-pro #BinanceAIPro#CryptoTrading#AITrading