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

Резултати

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

Пребарај: #zerofeetrading

当前筛选 #zerofeetrading清除筛选
Crypto M - Crypto News

@CryptoM · Post #64908 · 10.04.2026 г., 09:00

🚀 Binance Launches Zero-Fee Trading for BTC/U Pair According to the announcement from Binance, the platform is introducing a zero-fee trading promotion for the BTC/U spot and margin trading pair, effective from 2026-04-17 00:00 (UTC). This promotion will run until 2026-07-16 23:59 (UTC), allowing eligible users to trade without incurring maker and taker fees on this specific pair. However, during the promotion period, trading volume on the BTC/U pair will not contribute to the VIP tier volume calculation or any Liquidity Provider programs. Additionally, BNB discounts, referral rebates, and other adjustments will not apply to this trading pair. United Stables (U) is a next-generation stablecoin backed by fully fluid assets, designed to unify fragmented liquidity across various sectors including trading, payments, DeFi, institutional settlement, and AI-driven autonomous systems. It represents a "fluid" future where value seamlessly flows between humans and AI. Notably, U is the first batch of BNBChain stablecoin to support EIP-3009 gasless authorization, facilitating efficient value transfer across ecosystems. Users should be aware that standard trading fees will resume once the promotion period concludes. Trading eligibility is subject to the user's country or region of residence, with certain jurisdictions restricted from participating. These include Canada, Cuba, Crimea Region, Iran, Netherlands, North Korea, Syria, the United States and its territories, and non-government controlled areas of Ukraine. Binance reserves the right to disqualify users involved in dishonest behavior and to amend the promotion terms at its discretion. Participants must complete account verification to engage in trading these new pairs, and the list of restricted countries may change due to legal and regulatory updates. #Binance#BTCU#ZeroFeeTrading#Cryptocurrency#Stablecoin#DeFi#BNBChain#CryptoPromotion#DigitalAssets#CryptoTrading