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

Пребарај: #cryptotransactions

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

@CryptoM · Post #65069 · 10.04.2026 г., 18:29

🚀 Mempool Space Invaders Offers Satoshi Rewards for High Scores Mempool Space Invaders, a unique game utilizing real-time Bitcoin mempool transactions as targets, is offering players a reward of 10,000 satoshis for achieving a score of 10,000 BTC. According to NS3.AI, the game's creator mentioned that players could expedite reaching the target score by sending 10,000 BTC to themselves. This innovative approach combines gaming with cryptocurrency transactions, providing an engaging experience for Bitcoin enthusiasts. #MempoolSpaceInvaders#SatoshiRewards#Bitcoin#CryptoGaming#BTC#NS3AI#GamingWithCrypto#BitcoinMempool#CryptoTransactions

Venture Village Wall 🦄

@venturevillagewall · Post #3879 · 15.01.2025 г., 04:00

Trump Family Crypto Project Moves Millions The Trump family crypto project, World Liberty, executed a significant transaction today: exchanging 103.1493 WBTC for 3,075.198 ETH (approx. $9.9M) and 16.6199 WBTC for 1.7M USDT via Cow Protocol. Additionally, 11,917.635 ETH (valued around $38.4M) was transferred to Coinbase Prime. Separately, $XRP has crossed a market cap of $155 billion. Read more here. #Trump#Crypto#WBTC#ETH#USDT#Coinbase#XRP#MarketCap#Blockchain#DigitalAssets#Investment#Finance#DeFi#CowProtocol#WorldLiberty#CryptoMarket#Altcoins#TokenExchange#CryptoTransactions#VC

Venture Village Wall 🦄

@venturevillagewall · Post #3870 · 14.01.2025 г., 04:00

Sony Launches Blockchain Platform Soneium Sony's public blockchain platform, *Soneium*, has officially launched on the mainnet. This initiative aims to enhance its technology offerings in the blockchain space. Read more here. In a historic move, Italy's largest bank, *Intesa Sanpaolo*, has purchased 11 bitcoins valued at around €1 million, marking the first direct crypto transaction by a financial institution in Italy. Details can be found here. FTX/Alameda has redeemed and transferred 182,421 SOL (approx. $32.35M) today, raising the total since last November to 4.445M SOL (approx. $516.88M). The staked address currently holds 6.47 million SOL (approx. $1.18B). More information here. The US Court of Appeals ruled in favor of *Coinbase* in its case against the SEC, deeming the SEC's denial of rulemaking as “arbitrary and capricious.” This case revolves around establishing rules for digitally native asset securities. For further reading, click here. #Sony#Blockchain#Soneium#Bitcoin#ECB#Italy#IntesaSanpaolo#CryptoTransactions#FTX#SOL#Coinbase#SEC#DeFi#DigitalAssets#Cryptocurrency#Finance#Investing#VentureCapital#CryptoNews#CryptoMarket