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

Резултати

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

Пребарај: #binary

当前筛选 #binary清除筛选
Daily Channels

@dailychannels · Post #6341 · 09.09.2025 г., 01:00

Channel: Free Proven Binary, Forex, And Crypto Trading Signals Members: ~2.05K 💢 Username: @provensignals Description: "Wow 10 wins 0 losses today " - Subscriber “The best free binary signals Telegram” - Subscriber "91% VIP binary options trading signals" - Subscriber Visit https://provensignals.io to join for free! 🏷 Tags: #crypto_fx_trading #binary#binary_options#forex#cryptocurrencies#finance https://telegramchannels.me/channels/provensignals

Daily Channels

@dailychannels · Post #5906 · 17.03.2025 г., 01:00

Channel: YOO_BINARY_TRADING Members: ~6.79K 💢 Username: @yoo_binary_trading Description: Iq option & olymtrade trade and another (ALL BINARY & DIGITAL BROKER) ONLY 1 STEP MARTINGALE 90-95% Accuracy ️ Admin :- @extraders Admin 2:- @mirs65 https://t.me/Yoo_Binary_Trading 🏷 Tags: #crypto_fx_trading #binary#forex#trade#signal#50_60_signal https://telegramchannels.me/channels/yoo_binary_trading

Universe Mysteries 🪐

@cosmomyst · Post #657 · 03.02.2026 г., 12:21

🪐 Supernova 1993J in the galaxy Messier 81, about 11 million light-years from Earth, stunned astronomers when it exploded unusually brightly and faded much faster than typical supernovae. This stellar blast revealed clear evidence of two stars orbiting closely together—one feeding material to the other—helping scientists confirm that some supernova explosions are triggered by the complex dance of binary stars, not just the death of single massive stars. ✨ #supernova⚡#binary⚡#star⚡#M81⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

BotsGram®

@botsgram_cu · Post #3434 · 26.01.2021 г., 01:10

@textUtilsBot Qué puede hacer este bot? Bot en línea para transformaciones de texto. Puede ayudarlo a traducir texto del lenguaje humano a código binario o hexadecimal, cadena base64 y viceversa. Idioma: Inglés (visto en @BotsGram_cu) #inline, #utility, #base64, #binary, #hexadecimal, #convert