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

Пребарај: #offthegrid

当前筛选 #offthegrid清除筛选
Libreware

@libreware · Post #962 · 30.06.2021 г., 12:49

Off the Grid Messenger Off The Grid (OTG) Messenger is an easy way for people to communicate through text messages when in remote areas. With a theoretical transmission range of 10 miles (16kms), OTG messenger can be used by groups of people to stay connected when they are in areas not serviced by mobile connectivity. For portability and low power purposes, the device was created by re-purposing an old Nokia e63 phone I had laying around. The enclosure, LCD, keypad, backlighting and speaker have been re-used however the motherboard was re-designed from the ground up with low power components, a modern STM32 H7 microcontroller, an ISM LoRA radio and expanded flash memory. https://github.com/TrevorAttema/OTGMessenger Comments https://news.ycombinator.com/item?id=27659105 #otg#offthegrid#grid#im#messenger#alternatives#cellphone#mobile#nokia

Crypto M - Crypto News

@CryptoM · Post #64704 · 09.04.2026 г., 15:10

🚀 Gunzilla Games Faces Wage Delays Amid Token Decline Gunzilla Games is experiencing significant financial challenges, with employees reporting wage delays of up to five months. According to NS3.AI, CEO Vlad Korolev has stated that some payments are being scheduled to align with the company's cash flow. Several employees, including senior game programmer Vladyslav Spitkovskyi, are seeking compensation through the European Union legal framework. Additionally, the GUNZ token, integral to Off The Grid's in-game economy, has seen a substantial decline, dropping nearly 86% since its launch last year. #GunzillaGames#WageDelays#FinancialChallenges#TokenDecline#GUNZToken#OffTheGrid#GameDevelopment#EmployeeCompensation#EuropeanUnion#VladKorolev