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

Пребарај: #onchaindetection

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

@CryptoM · Post #64878 · 10.04.2026 г., 06:15

🚀 Huang Licheng Achieves Profitable Trading Streak Huang Licheng, also known as 'Machi Big Brother,' has maintained a successful trading streak without liquidation for 10 days. According to BlockBeats On-chain Detection, he has completed 13 consecutive profitable trades, earning a profit of $1.14 million over the past week. #HuangLicheng#Trading#CryptoTrading#ProfitStreak#Blockchain#OnChainDetection#CryptoInvesting#MachiBigBrother

Crypto M - Crypto News

@CryptoM · Post #64534 · 09.04.2026 г., 06:35

🚀 BTC Short Position Expanded by Strategy Counterparty On April 9, a significant adjustment was made to a BTC short position by the entity known as 'Strategy Counterparty' (0x94d3). According to BlockBeats On-chain Detection, the position was increased by 81.06 BTC, valued at approximately $5.209 million. The total position size has now reached $75.2048 million, with the average price slightly rising from $69,036.20 to $69,181.40. The liquidation price is set at $79,320.81. Currently, the position is experiencing a floating loss of approximately $1.8229 million, marking a decrease of 96.96%. This makes it the largest BTC short position on the Hyperliquid platform. It is noted that this address previously established a substantial short position against mainstream cryptocurrencies during MicroStrategy's significant BTC acquisitions last December. At that time, the position size peaked at $120 million, making it the largest BTC short on the Hyperliquid platform. #BTC#ShortPosition#StrategyCounterparty#Blockchain#OnChainDetection#Crypto#Hyperliquid#FloatingLoss#BTCShort#MarketAdjustment#Cryptocurrency

Crypto M - Crypto News

@CryptoM · Post #65228 · 12.04.2026 г., 06:13

🚀 Whales Accumulate TRUMP Tokens Ahead of Trump Luncheon On April 12, two significant cryptocurrency holders have been accumulating TRUMP tokens in anticipation of a luncheon with U.S. President Donald Trump. According to BlockBeats On-chain Detection, Whale 8DHkza has withdrawn 850,488 TRUMP tokens from a centralized exchange over the past two days. Meanwhile, Whale 7EtuAt extracted 105,754 TRUMP tokens from another centralized exchange 17 hours ago, bringing their total holdings to 1.13 million TRUMP tokens. #Whales#TRUMPTokens#DonaldTrump#Cryptocurrency#Blockchain#CryptoWhales#Luncheon#OnChainDetection#CentralizedExchange