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

Пребарај: #latestsoftware

当前筛选 #latestsoftware清除筛选
MikroTik.SG

@mikrotiksg · Post #314 · 30.07.2025 г., 06:56

Current MikroTik Software Release RouterOS: 7.19.4 | 6.49.18 Winbox: 3.42 / 4.0beta26 SwitcOS: 2.18 SwitchOS lite: 2.20 If you missed 7.19.3, Significantly improved Wi-Fi 6 Performance with RouterOS v7.19.3 (stable) Significantly improved Wi-Fi 6 Performance with RouterOS v7.19.3 (stable) If you've been waiting for a sign to explore MikroTik's Wi-Fi 6 solutions - this is it. With RouterOS v7.19.3, MikroTik has introduced significant improvements to 802.11ax (Wi-Fi 6) device performance. This update enhances range, stability, and overall wireless experience, making it the best time yet to deploy Wi-Fi 6 in your home, office, or enterprise setup. MikroTik is continuously working to improve AX performance across all supported MikroTik devices, and this update is a major step forward. Whether you're using a single AP or building a complex multi-device setup, you'll notice the difference. But there's more to this update: from enhanced IPv6 FastPath support to hardened RADIUS (RadSec) and smarter LTE/eSIM handling, the system is now more robust under real-world stress. For best results and security, always use the latest stable RouterOS version. Version 7.19.3 is currently our recommended release for anyone using Wi-Fi 6 hardware. #MikroTik#RouterOS#AlagasNet#LatestSoftware