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

Резултати

Пронајдени 5 слични објави

Пребарај: #davidsacks

当前筛选 #davidsacks清除筛选
Venture Village Wall 🦄

@venturevillagewall · Post #4292 · 03.03.2025 г., 04:00

Sacks Sells Crypto Holdings Amid Review David Sacks, White House AI and crypto czar, sold all his Bitcoin, Solana, and Ethereum holdings post-Trump's inauguration. This move precedes a government ethics review with plans for a full holdings update. More details: FT. #AI#Crypto#VC#Bitcoin#Ethereum#Solana#DavidSacks#CraftVentures#TrumpAdministration

Crypto M - Crypto News

@CryptoM · Post #64750 · 09.04.2026 г., 18:16

🚀 David Sacks Calls for Congressional Action on CLARITY Act David Sacks has called on Congress to pass the CLARITY Act, emphasizing that it would establish clear regulations for all crypto assets. According to NS3.AI, Sacks highlighted that last year's stablecoin regulation bill positioned the U.S. as a leader in the stablecoin industry. He also predicted that U.S. President Donald Trump will sign the bill into law. #DavidSacks#CLARITYAct#Congress#CryptoRegulation#Stablecoins#USPolitics#Cryptocurrency

Crypto M - Crypto News

@CryptoM · Post #65252 · 12.04.2026 г., 10:15

🚀 CLARITY Act Urged for Swift Advancement in Crypto Regulation Cynthia Lummis emphasized the urgency of advancing the CLARITY Act, warning that delays could push the next opportunity for establishing a crypto regulatory framework to 2030. According to NS3.AI, notable figures such as David Sacks, Brian Armstrong, and SEC Chairman Paul Atkins have also expressed support for expediting market structure legislation. #CLARITYAct#CryptoRegulation#CynthiaLummis#NS3AI#DavidSacks#BrianArmstrong#PaulAtkins#SEC#MarketStructure#Legislation

Venture Village Wall 🦄

@venturevillagewall · Post #4288 · 02.03.2025 г., 19:00

Trump's Crypto Reserve Announcement Shakes Market President Trump recently revealed plans for a U.S. Crypto Strategic Reserve, leading to a significant surge in Bitcoin value, which rose 10% to $94,000. The reserve will include Bitcoin, XRP, Solana, and Cardano, positioning the U.S. as a potential leader in the crypto space. Following this announcement, nearly $500 million in shorts were liquidated within four hours. The announcement reflects Trump's commitment to strengthen the crypto industry after previous governmental opposition. More updates are expected at the upcoming crypto summit in the White House on March 7. #Crypto#Bitcoin#XRP#Solana#Cardano#TRUMP#U.S. #CryptoReserve#MarketUpdate#ShortsLiquidation#WhiteHouse#Summit#Finance#Investment#Assets#Blockchain#DavidSacks#Economy#DigitalAssets#Trading

Venture Village Wall 🦄

@venturevillagewall · Post #4069 · 04.02.2025 г., 22:00

US Forms Joint Group for Crypto Rules David Sacks announced a joint working group of the U.S. House and Senate, focusing on advancing cryptocurrency legislation, starting with stablecoins. Additionally, a feasibility study for a U.S. Bitcoin reserve is underway. Read more. Senator Bill Hagerty has introduced legislation for a regulatory framework for stablecoins. Details here. #US#Crypto#Stablecoins#Bitcoin#Legislation#Securities#DeFi#Blockchain#Finance#DavidSacks#Senate#House#BitcoinsReserve#BAMM#FraxFinance#Hagerty#SEC#CryptoTaskForce#Regulation