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

Резултати

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

Пребарај: #futo

当前筛选 #futo清除筛选
Libreware

@libreware · Post #1455 · 03.05.2025 г., 22:27

#FUTO#Keyboard Updates: The Swipe Dataset is Public! https://peertube.futo.org/videos/watch/44d2e41a-307b-49ab-9a14-1e2e1eaa9a94 You can access the dataset here: https://huggingface.co/datasets/futo-org/swipe.futo.org More info about FUTO Keyboard https://t.me/Libreware/1299 You can learn more about FUTO here: https://futo.org

Libreware

@libreware · Post #1452 · 03.05.2025 г., 11:47

FUTO is launching a new open-source software distribution project: the FUTOcore Software Store. https://www.bitchute.com/video/dVmDId8GPn8b/ You can learn more about FUTOcore and participate in our survey here: https://futocore.futo.org/ This talk was given by Adam Jesionowski on March 15 during FUTO's Don't be Evil Conference #futo#apk#store

Libreware

@libreware · Post #1299 · 29.06.2024 г., 08:35

FUTO Keyboard Keyboard being developed, forked from the AOSP keyboard. The goal is to create a good, customizable keyboard that doesn't sacrifice on privacy or freedoms. If you're testing this, please join either the Discord server or the FUTO chat. Your feedback is valuable during this testing period https://keyboard.futo.org https://gitlab.futo.org/alex/keyboard-wiki/-/wikis/FUTO-Keyboard https://github.com/futo-org/android-keyboard/issues https://app.futo.org/fdroid/repo?fingerprint=39D47869D29CBFCE4691D9F7E6946A7B6D7E6FF4883497E6E675744ECDFA6D6D Solving #Google's #Keyboard Privacy Issue: Introducing Offline #voice to text & #keyboard from #FUTO https://odysee.com/solving-google's-keyboard-privacy-issue#7b51783c3bb27a967223ac3a7c3eb756267b1594 https://github.com/abb128/LiveCaptions https://www.nytimes.com/2022/08/21/technology/google-surveillance-toddler-photo.html https://youtu.be/r09Hm2zd2lY https://www.youtube.com/watch?v=_vWAF13KigI 👉 Rossmann chat: https://matrix.to/#/#rossmannrepair:matrix.org #futo#android#keyboard

Libreware

@libreware · Post #1312 · 29.07.2024 г., 14:12

Harbor Decentralized p2p identity verification system. Identity management application written, targeting iOS, and Android, built on Polycentric. Create pseudonymous identities, make claims, link identities across applications. Checkout harbor.social, or docs.polycentric.io for more information What is Harbor and How it Works: https://peertube.futo.org/w/939a212d-920f-4411-b9b6-d60aa4ef4db7 https://gitlab.futo.org/polycentric/harbor/ #p2p#id#verification#futo