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

Пребарај: #ether

当前筛选 #ether清除筛选
SIGNAL

@finsignal · Post #3127 · 23.05.2024 г., 06:55

Good morning, everyone! 🌄 🤔 The cue ball froze around 69.500, but the #Ether, despite the sideways bitcoin, is trying to grow and is trading around 3800. I think that they will try to get through the Air today or tomorrow to the 3.850-3.870 area. But then everything will depend on #Bitcoin: if the cue ball supports the market with growth, then the #Ether will be able to go above $ 4,000. 😎In general, nothing has been dented on the market since yesterday and the alignment is still the same.

Venture Village Wall 🦄

@venturevillagewall · Post #4158 · 15.02.2025 г., 10:00

OM Whale Transfers Millions to Binance A significant OM whale (0x17...fe76) transferred 10.711 million OM to Binance today, valued at approximately 80.88 million USD. Previously, this whale had withdrawn OM worth around 4.82 million USD from Binance between March 1-6, 2024. This indicates a potential profit nearing 84 million USD for the whale. More Details #OM#Binance#Crypto#Whale#Investment#Market#Profit#Trading#Blockchain#Ether

Crypto M - Crypto News

@CryptoM · Post #64763 · 09.04.2026 г., 20:15

🚀 Ether Rises Over 6% as Undervaluation Signals Potential Retest of Higher Levels Ether experienced a 6.33% increase, surpassing $2,150, with indicators suggesting a potential retest of the $2,400–$2,500 range. According to NS3.AI, the Capriole Macro Index Oscillator registered a reading of -2.42, indicating that Ether is in a rare undervaluation zone. This development has sparked interest among investors, who are closely monitoring the cryptocurrency for further movements. #Ether#Crypto#Ethereum#Undervaluation#PriceIncrease#Investment#CryptoTrading#NS3AI#ETH

Crypto M - Crypto News

@CryptoM · Post #65226 · 12.04.2026 г., 05:55

🚀 Bitcoin and Ether Prices Could Signal Sustainable Growth, Says Analyst Macro analyst Jordi Visser has suggested that Bitcoin surpassing $76,000 and Ether exceeding $2,400 might indicate the beginning of a sustainable upward trend this year. According to NS3.AI, Visser expressed confidence in the market's resilience, noting that he does not foresee a recession. Additionally, data from the United States Bureau of Labor Statistics revealed that the Consumer Price Index (CPI) for April increased by 3.3% compared to the previous year. #Bitcoin#Ether#Cryptocurrency#MarketAnalysis#SustainableGrowth#MacroEconomics#CPI#Inflation#BTC#ETH