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

Пребарај: #pixelage

当前筛选 #pixelage清除筛选
Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #553 · 05.02.2025 г., 18:08

Pixelage Official | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 2.5 - Codename: #Pong - Released: 5/2/25 🔽 Download: Here | Mirror 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#pixelage#V#qpr1 ✨ Changelogs - switched to a different tree - clean flash recommended ✍️ Note: - Meteoric kernel is baked in with prepatched KSU - gapps inbuilt, don't flash gapps 🏆 Credits - @Ghosuto7 for trees - Fabian for PA Glyph Implementation 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #524 · 23.01.2025 г., 08:38

Pixelage Official | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 2.4 - Codename: #Pong - Released: 23/1/24 🔽 Download: [ Here ] (Sideload/Flash via orangefox recovery) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#pixelage#V#qpr1 ✨ Changelogs - updated to NOS V3.0-250113-1723 ✍️ Note: - Meteoric kernel is baked in with prepatched KSU - gapps inbuilt, don't flash gapps - IF CLEAN FLASHING MAKE SURE TO REMOVE SCEEEN LOCK FROM PREVIOUS ROM 🏆 Credits - Chandu for base DT - Hellboy for Meteoric kernel - Fabian for PA Glyph Implementation - Testers: @Devasee@notnaito 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #502 · 30.12.2024 г., 13:59

Pixelage Official | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 2.3 - Codename: #Pong - Released: 30/12/24 🔽 Download: [ Here ] (Sideload/Flash via orangefox recovery) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#pixelage#V#qpr1 ✨ Changelogs - official build ✍️ Note: - Meteoric kernel is baked in with prepatched KSU - gapps inbuilt, don't flash gapps 🏆 Credits - Chandu for base DT - Hellboy for Meteoric kernel - Fabian for PA Glyph Implementation - Testers: @Devasee@notnaito 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #497 · 21.12.2024 г., 16:37

Pixelage | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 2.3 - Codename: #Pong - Released: 12/12/24 🔽 Download: [ Here | sourceforge ] (Sideload/Flash via orangefox recovery) 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Source Changelogs: Here 🔖 Tags : #ROM#AOSP#pixelage#V#qpr1 ✨ Changelogs - qpr1 ✍️ Note: - Meteoric kernel is baked in with prepatched KSU - gapps inbuilt, don't flash gapps 🏆 Credits - Chandu for base DT - Hellboy for Meteoric kernel - Fabian for PA Glyph Implementation - Testers: @Devasee@notnaito 😎 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2

Nothing Phone (2) | Updates

@NothingPhone2Updates · Post #633 · 12.06.2025 г., 11:27

Pixelage - Official | Android 15 | Nothing Phone (2) ✍️ Details: - Version: 2.8 - Codename: #Pong - Type: #Gapps - Released: 10/6/25 🔽 Download: Here | Mirror 🆘 Support : Here ⚙️ Installation: Here 📸 Screenshots: Here ✨ Changelogs: Here 🔖 Tags : #ROM#AOSP#Pixelage#V#QPR2#Official ✍️ Note: - Meteoric kernel is baked in with prepatched KSU - Gapps inbuilt, don't flash gapps 🏆 Credits - @Ghosuto7 for trees - Hellboy & Fabian for PA Glyph Implementation 👤 Maintainer : @Drishal 🔔 Updates : @NothingPhone2Updates 💬 Chat : @NothingPhone2