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

Резултати

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

Пребарај: #limited

当前筛选 #limited清除筛选
电竞红单作业推荐-中文频道

@dianjingtuijian01 · Post #9351 · 12.04.2026 г., 11:23

【#Yunxiao Sports】https://yunxiao61.vip(reputation disk)🥰 (reputation disk)🥰 😀😀😀😀😀 😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀 🤭No IP limit (you can deposit and withdraw via U for the first time)🥰 🤭"Zero review and worry-free for large amounts" 🤭The world's most prestigious betting market from Europe! The platform supports USDT, GOpay, OKpay, EBpay, WeChat, Alipay, virtual currency and other payment deposits and withdrawals👉 (1:1 for member EB sales) 🤭Open an account and get free gifts ✅#Limited time event: first deposit 300 will get you 178. If you deposit 500, you will get 288. 🤭Large customers with a single deposit of 1 million (no need to worry about making large withdrawals). Financial analysts are welcome to compete in Dog Village ❗️ 🤭Important things to say twice: Withdraw money in seconds without stuck money Withdraw money in seconds without stuck money❗️ ⚡️⚡️⚡️⚡️⚡️⚡️ ⚡️⚡️⚡️⚡️⚡️⚡️⚡️ 🤭The daily deposit bonus for the first deposit will not stop, 2% will be given for daily deposit, and more will be given on weekends. There are also monthly cash rebates, etc. 🤭If you meet the deposit requirement of 200,000 within 30 days of registration, you will receive a young model or the latest Apple mobile phone. 🌐Yunxiao Sports:https://yunxiao61.vip 🌐Event Specialist: @qiuxiaomi9876🥰 🤤😪😮‍💨😵😛😝😜🤪🤨🧐🤓😎🥸 🤭e-sports sports agreement to stabilize channels👉✈️@dianjingtuijian01

电竞红单作业推荐-中文频道

@dianjingtuijian01 · Post #9280 · 07.04.2026 г., 09:03

【#Yunxiao Sports】https://yunxiao61.vip(reputation disk) 🥰 (reputation disk) 🥰 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 😀 🤭No IP limit (you can deposit and withdraw via U for the first time) 🥰 🤭"Zero review and worry-free for large amounts" 🤭The world's most prestigious betting market from Europe! The platform supports USDT, GOpay, OKpay, EBpay, WeChat, Alipay, virtual currency and other payment deposits and withdrawals👉 (1:1 for member EB sales) 🤭Open an account and get free gifts ✅#Limited time event: first deposit 300 will get you 178. If you deposit 500, you will get 288. 🤭Large customers with a single deposit of 1 million (no need to worry about making large withdrawals). Financial analysts are welcome to compete in Dog Village ❗️ 🤭Important things to say twice: Withdraw money in seconds without stuck money Withdraw money in seconds without stuck money❗️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ ⚡️ 🤭The daily deposit bonus for the first deposit will not stop, 2% will be given for daily deposit, and more will be given on weekends. There are also monthly cash rebates, etc. 🤭If you meet the deposit requirement of 200,000 within 30 days of registration, you will receive a young model or the latest Apple mobile phone. 🌐Yunxiao Sports:https://yunxiao61.vip 🌐Event Specialist: @qiuxiaomi9876🥰 🤤 😪 😮‍💨 😵 😛 😝 😜 🤪 🤨 🧐 🤓 😎 🥸 🤭e-sports sports agreement to stabilize channels👉✈️@dianjingtuijian01

KizlyarSupreme

@kizlyarsupreme · Post #1287 · 11.03.2025 г., 12:19

Друзья, представляем нож Colada, выпущенный ограниченным тиражом. Colada – это компактный нож-универсал, один из самых популярных в линейке Kizlyar Supreme. Простота, красота, завершенность - и ничего лишнего. Клинок классической формы выполнен из культовой немецкой стали PGK, а рукоять - из прочного черного композита. Сталь PGK на клинке закалена до твердости 62-63 HRC - нож отлично держит заточку и обладает потрясающим резом. Обычно при такой твердости клинки становятся хрупкими, но только не из стали PGK! Если вы хотите совместить: 🔪 отличный рез, 👌 удержание заточки 🗿 и высочайшую прочность, смело выбирайте клинок из PGK. Рукоять с выраженной шероховатой фактурой выполнена из черного G10. Нож комплектуется красивыми и удобными погружными кожаными ножнами с петлей свободного подвеса. Купить в официальном интернет-магазине◀️ #Colada#Limited#PGK

12
ПретходнаСтраница 1 од 2Следна