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

Пребарај: #clients

当前筛选 #clients清除筛选
GitHub Trends

@githubtrending · Post #14935 · 09.07.2025 г., 13:30

#other#clients#mcp The Model Context Protocol (MCP) is an open standard that lets AI models easily and securely connect to different data sources and tools, making it much simpler for developers to build smart apps that can access files, databases, and APIs without custom code for each one[2][3][4]. There are many free and easy-to-use MCP clients—like desktop apps, web apps, and command-line tools—that let you quickly add new AI features and automate tasks, so you can get more done with less effort and technical hassle. This means you can use AI to help with coding, data analysis, and daily work, all while keeping your data safe and your setup flexible[2][3][4]. https://github.com/punkpeye/awesome-mcp-clients

djangoproject

@djangoproject · Post #327 · 30.04.2017 г., 01:28

https://www.tutorialspoint.com/python/python_networking.htm Python provides two levels of access to network services. At a low level, you can access the basic #socket support in the underlying operating system, which allows you to implement #clients and #servers for both connection-oriented and connectionless protocols.

Upwork Profile Mastery

@UpworkProfilePro · Post #568 · 19.02.2026 г., 09:52

Most freelancers fail before they even start… because they skip this one step! They rush into work without truly understanding the client’s needs. Knowing their goals helps you deliver exactly what they expect. Good communication builds trust and long-term relationships. 👉 What do you think? React if you agree. @UpworkProfilePro #Tipsoftheday#Clients#communication