@dreamsgallerys · Post #1291 · 12.10.2023 г., 10:01
Dreams Gallery By Voodoont #voodoont #арт#art#ai#retro#console#nintendo#ps#old
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
Пребарај: #console
@dreamsgallerys · Post #1291 · 12.10.2023 г., 10:01
Dreams Gallery By Voodoont #voodoont #арт#art#ai#retro#console#nintendo#ps#old
@githubtrending · Post #15135 · 10.09.2025 г., 13:00
#javascript#ansi#ansi_escape_codes#chalk#cli#color#commandline#console#javascript#strip_ansi#terminal#terminal_emulators Chalk is a popular Node.js tool that lets you easily add colors and styles to text in the terminal, making your console output clearer and more attractive. It supports many colors, including 256 and truecolor (millions of colors), and allows you to combine and nest styles like bold, underline, and background colors. Chalk auto-detects if your terminal supports colors and works without adding dependencies or changing built-in string behavior. You can create custom themes and use template literals for dynamic, colorful logs. This helps you highlight important information in your terminal output, improving readability and debugging. Chalk is reliable, actively maintained, and widely used in many projects. https://github.com/chalk/chalk
@githubtrending · Post #15000 · 27.07.2025 г., 12:00
#markdown#android#bsd#cheatsheet#cheatsheets#command_line#console#documentation#examples#hacktoberfest#help#linux#macos#man_page#manpages#manual#osx#shell#terminal#tldr#windows The tldr-pages project offers simple, easy-to-understand help pages for command-line tools, focusing on practical examples rather than long, complex manuals. It’s great if you’re new to the command line or forget command options, as it shows the most useful commands clearly. You can access these pages through various clients or online without installing anything. This saves you time and frustration by giving quick, clear guidance on common tasks, making it easier to learn and use command-line tools effectively. Plus, you can contribute by adding or improving pages yourself. This helps you and others get fast, practical help with commands[1][4]. https://github.com/tldr-pages/tldr
@KartInfoTW · Post #470 · 10.01.2023 г., 02:01
🚀《跑跑卡丁車:飄移》全平台正式開放下載,同時事前預約活動也即將在 1/12 結束, 更多事前預約活動資訊以及遊戲下載連結立即點擊查看 👇 🔥 完整遊戲資訊:https://kinf.cc/wrrUP ⭐️ 飄移未來發展:https://kinf.cc/E45Ty ▶️ 追蹤 Google 新聞:https://kinf.cc/gn ▶️ 立即加入 Discord:https://kinf.cc/dc #跑跑卡丁車#KartRider#飄移#跑跑飄移#KartRiderDrift#KartDrift#事前預約#季前賽#PreSeason#公測#PublicBeta#下載#Download#PC#Windows#Nexon#Steam#Console#XBOXOne#PS4#Mobile#AppStore#GooglePlay#iPad