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

Резултати

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

Пребарај: #geolocation

当前筛选 #geolocation清除筛选
Libreware

@libreware · Post #1512 · 28.09.2025 г., 11:58

Chasing Your Tail (CYT) https://github.com/ArgeliusLabs/Chasing-Your-Tail-NG A comprehensive #WiFi probe request analyzer that monitors and tracks wireless devices by analyzing their probe requests. The system integrates with #Kismet for packet capture and WiGLE API for #SSID#geolocation analysis, featuring advanced #surveillance#detection capabilities. Features Real-time Wi-Fi monitoring with Kismet integration Advanced surveillance detection with persistence scoring Automatic GPS integration - extracts coordinates from Bluetooth GPS via Kismet GPS correlation and location clustering (100m threshold) Spectacular KML visualization for Google Earth with professional styling and interactive content Multi-format reporting - Markdown, HTML (with pandoc), and KML outputs Time-window tracking (5, 10, 15, 20 minute windows) WiGLE API integration for SSID geolocation Multi-location tracking algorithms for detecting following behavior Enhanced GUI interface with surveillance analysis button Organized file structure with dedicated output directories Comprehensive logging and analysis tools Requirements Python 3.6+ Kismet wireless packet capture Wi-Fi adapter supporting monitor mode Linux-based system WiGLE API key (optional)

djangoproject

@djangoproject · Post #241 · 25.01.2017 г., 13:30

http://www.aparat.com/v/4yGhH #Geolocation apps with #Django. Latitude, longitude, altitude, and even #iBeacons can be leveraged to enable geo-targeted experiences. But how do we build and optimize the server-side components to handle these requirements? Using a combination of libraries and techniques, we will illustrate these concepts. In this discussion everything from #map clustering and caching, to distance calculations and polygonal layering will be demonstrated using Django, #GeoDjango, #Redis, and #PostGIS as our tool belt.