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

Пребарај: #cryptoux

当前筛选 #cryptoux清除筛选

USDE by 👍XBANKING — A Next-Generation Decentralized Stablecoin XBANKING has launched USDE, a new stablecoin built specifically for DeFi, trading, and everyday payments. USDE blends stability, decentralization, and yield — offering 8% APR just for holding. Built on the 🤑 Solana blockchain. 💰USDE minting is now live ➡️app.xbanking.org 👍 1 USDE = 1 USD — always. It’s backed 1:1 by liquid assets — USDT and USDC, with real-time reserves exceeding 101%. 🔎Why hold USDE? ✔️ Earn 8% APR simply by holding — the yield is built into the token. ✔️ No need to chase DeFi protocols or calculate risks — USDE starts earning immediately. ✔️ Use it like any other stablecoin: trade, add to liquidity pools, lend, or borrow. ✔️ 100%+ backed by USDT and USDC — no liquidation risks like with collateralized stablecoins. ✔️ Runs on Solana — fast, cheap, and user-friendly. 😀How does it work? • Users deposit USDT or USDC into the XBANKING smart contract • In return, they receive USDE at a 1:1 ratio • The deposited stablecoins are allocated to DeFi strategies (liquidity pools, farming, etc.) • The yield is distributed among all USDE holders 💼What you can do with USDE ✔️ Hold to earn 8% APR ✔️ Swap to USDT or USDC with zero fees ✔️ Trade on DEXs (available on Raydium) ✔️ Provide liquidity ✔️ Lend and borrow 🛡 What makes USDE stand out? • Backed only by $USDT and $USDC • Reserves exceed 100% • 8% APR just for holding • Minting and burning are controlled via smart contracts • No liquidation mechanisms — unlike collateralized stablecoins • Includes a token freeze function as an additional safeguard against phishing or exploits 📌Where to use USDE — Mint: app.xbanking.org — Smart contract: 8dt9fQhoRKuWCSAsYweG2UMF3rbcG9xzNCTWXXSmdmEi — View on Solscan — DEX: Raydium USDE by XBANKING — a hybrid stablecoin designed for active DeFi use and long-term yield. #USDE#Xbanking#Stablecoin#DeFi#Solana#Raydium#CryptoUX