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

Пребарај: #supplyshock

当前筛选 #supplyshock清除筛选
以太坊区块链新闻| ETH 以太币圈热瓜

@ethereumglobalnews · Post #1565 · 14.12.2025 г., 13:58

🪙Bitmine has emerged as one of the largest corporate ETH holders. 🚨#最新数据:Bitmine Immersion Tech 目前持有 3.86M 枚 ETH,占全网流通供应量的 3.2%,总价值约 $12B。 #Markets#解析#比特币 #Ethereum#OnChain#Crypto —————— 📊 关键指标: • 公司市值:$14.84B • ETH 储备占比:3.2% of supply • 可用现金:$1B • EPS 增长:+189% 🧠 市场影响: 当 ETH 持续被锁入企业资产负债表, 👉 可流通供给下降 👉 中长期供需结构趋紧 👉 价格波动对增量资金更敏感 #ETH#Treasury#SupplyShock 👇Tip👇讚 或點擊進行💎資源搜索👇

Crypto M - Crypto News

@CryptoM · Post #64792 · 10.04.2026 г., 00:06

🚀 Global Economic Concerns Amid Middle East Tensions According to Jin10, a report by China International Capital Corporation (CICC) highlights that since March, concerns over conflicts involving the U.S., Israel, and Iran, along with potential blockages in the Strait of Hormuz, have triggered a market-wide risk aversion. This has led to declines in most asset classes, excluding oil and agricultural products, raising fears of stagflation. CICC acknowledges the undeniable impact of supply shocks, which could potentially slow overall economic growth. However, if the Strait of Hormuz gradually reopens, the geopolitical risks might exacerbate the K-shaped economic divergence, leading to increased investment activity while cooling consumption and employment. In the context of accelerated AI substitution and an inherently cooling labor market, inflation in resource and capital goods is unlikely to create a 'wage-inflation' spiral. From this perspective, CICC suggests that the mainstream narrative of global stagflation might be overstated. The report reiterates the view held since the beginning of the year that, amid an intensified K-shaped economy, liquidity recovery from its trough, and sustained fiscal expansion, the global nominal economic cycle driven by investment is expected to resume its upward trend. This will likely lead to continued rebalancing of global funds across sectors, asset classes, and regions, benefiting a range of physical assets and emerging markets. #GlobalEconomy#MiddleEastTensions#GeopoliticalRisk#Stagflation#SupplyShock#EconomicGrowth#KShapedRecovery#Investment#AIImpact#LaborMarket#Inflation#LiquidityRecovery#FiscalExpansion#EmergingMarkets#AssetAllocation