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

Пребарај: #cryptofinance

当前筛选 #cryptofinance清除筛选
FXStreet Crypto News

@fxstreetcrypto · Post #53550 · 27.03.2026 г., 14:37

🚨NASDAQ Tokenization is here. The SEC just approved NASDAQ’s move to 24/7 trading with T+0 settlement for major indices. It’s no longer a crypto experiment – this is institutional-grade, on-chain access to the US stock market. S&P Dow Jones Indices just licensed data for perpetual futures on Hyperliquid, bypassing traditional brokers. This isn’t niche. It’s the future of trading. Don't get left behind. 👇Watch the breakdown now: 🔗https://www.youtube.com/watch?v=qMNRqfVgqPE #NASDAQTokenization#CryptoFinance#Blockchain

Crypto M - Crypto News

@CryptoM · Post #64931 · 10.04.2026 г., 10:34

🚀 Orderly Network Announces Management Transition for OmniVault Orderly Network has announced that Vovega will take over management responsibilities for OmniVault from Kronos. According to Foresight News, the transition will maintain the current management authorization and style, continuing to operate under a fully hedged strategy framework. The focus will remain on minimizing net exposure and drawdowns, aiming to provide depositors with more stable returns. The transition is scheduled for April 12, with a temporary suspension of deposits and withdrawals at 13:00, resumption at 16:00, and formal completion at 17:00. #OrderlyNetwork#OmniVault#ManagementTransition#HedgingStrategy#CryptoFinance#StableReturns

Crypto M - Crypto News

@CryptoM · Post #64749 · 09.04.2026 г., 17:59

🚀 Tokenized RWA Market Expected to Reach $400 Billion by 2030 The distributed tokenized real-world asset (RWA) market is projected to expand significantly, growing from approximately $29 billion today to $400 billion by 2030. According to NS3.AI, a report by Keyrock and Securitize highlights this anticipated growth, noting that RWA perpetual futures volumes have increased 40 times over six months, reaching $67 billion in monthly volume. Additionally, the report indicates that tokenized Treasury bills offered higher returns than DeFi's benchmark stablecoin lending rate on 98% of days in the first quarter of 2026. #TokenizedAssets#RWA#DeFi#Blockchain#FinancialMarkets#TreasuryBills#DigitalFinance#CryptoFinance#InvestmentTrends#FinTech