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

Резултати

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

Пребарај: #techbreakthroughs

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

@CryptoM · Post #65265 · 12.04.2026 г., 12:44

🚀 Paradigm CEO Highlights Gen Z's Impact on Crypto Innovation Paradigm, a crypto investment firm managing approximately $12 billion, is led by co-founder and CEO Matt Huang. According to Odaily, Huang acknowledges that while Gen Z employees can sometimes create chaos, their creativity and technological breakthroughs are impressive. He remains committed to investing in young talent, citing the example of Charlie Noyes, who joined Paradigm at 19 after dropping out of MIT. Noyes played a crucial role in MEV research and Flashbots investment, contributing significantly to the Ethereum ecosystem. Huang likens the Paradigm team to running an 'X-Men Academy,' noting that despite the unpredictability of young employees, their technical skills and innovation often surpass those of traditional professionals. #GenZ#CryptoInnovation#Paradigm#MattHuang#Ethereum#MEV#Flashbots#Investment#YoungTalent#TechBreakthroughs#XMenAcademy#ETH