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

Пребарај: #foss

当前筛选 #foss清除筛选
Libreware

@libreware · Post #904 · 19.02.2021 г., 19:25

[email protected] - Drizzle in my repo today with 2 new apps. Most prominently: Watomatic – to help those of you still stuck at WhatsApp to leave that s(t)inking ship without being afraid "nobody can find you": it sends auto-responses to everyone writing you, telling them you've left and where to look. So: no more excuses, here's your door! https://apt.izzysoft.de/fdroid/index/apk/com.parishod.watomatic​ Further running: SpaceXFollower (SpaceX events, facts, statistics) and Auxio, a nice music player, added yesterday. Enjoy #foss#Android#apps with #fdroid!

AIGC

@aigcrubbish · Post #224 · 02.03.2026 г., 15:42

[$] The exploitation paradox in open source 自由开源软件(FOSS)运动的核心是赋予个人和组织自由与权力,但其发展历程中,总存在试图利用FOSS谋取私利的参与者。在2026年比利时根特的配置管理营(CfgMgmtCamp)上,Richard Fontana阐述了开源的“剥削悖论”:即反复出现的危机模式,一些参与者利用规则漏洞来限制自由或在社区中获得对他人的优势。他还讨论了弥补这些漏洞的尝试,以及有必要超越许可证本身,以寻求维持自由的其他手段。 原文链接:https://lwn.net/Articles/1058031/ #开源#FOSS#社区治理#软件自由 #AIGC Read more

Daily Channels

@dailychannels · Post #5942 · 26.03.2025 г., 01:00

Channel: FOSS Post Members: ~2.04K 💢 Username: @fosspost Description: FOSS Post is a high-quality online magazine about Linux and open source software. This channel posts daily news from all over the web too. Website: https://fosspost.org 🏷 Tags: #technology #linux#open_source#foss#technology#free_software https://telegramchannels.me/channels/fosspost

GitHub Trends

@githubtrending · Post #15615 · 15.04.2026 г., 11:30

#python#android#android_apps#f_droid#foss#free_and_op#free_and_open_source#izzyondroid#open_source#opensource This list offers free open-source Android apps for every need—from browsers, cameras, and music players to games, tools, and F-Droid stores like Neo-Store. Get them via F-Droid or IzzyOnDroid for no ads or tracking. It boosts your privacy and freedom by ditching Google apps, letting you control your data and phone fully. https://github.com/offa/android-foss