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

Резултати

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

Пребарај: #goldprices

当前筛选 #goldprices清除筛选
Crypto M - Crypto News

@CryptoM · Post #65364 · 13.04.2026 г., 02:43

🚀 PRECIOUS METALS | Gold Prices in Uncertain Range Amid Middle East Tensions Gold prices are currently positioned in the middle of a fluctuating range, with short-term predictions remaining uncertain. According to Jin10, the market is bracing for a potential escalation in Middle East conflicts, which has led to gold prices opening lower during the Asian trading session. Analysts suggest that the price of gold may continue to hover within this range, making it difficult to predict future movements in the short term. #GoldPrices#MiddleEastTensions#PreciousMetals#MarketUncertainty#Gold#TradingSession

Crypto M - Crypto News

@CryptoM · Post #64515 · 09.04.2026 г., 05:30

🚀 PRECIOUS METALS | Chinese Gold Jewelry Prices Drop Significantly Gold jewelry prices in China have seen a notable decline today, according to Jin10. Several brands have reduced their prices by approximately 25 yuan compared to yesterday. The current prices are mostly in the range of 1,445 yuan to 1,450 yuan per gram. #preciousmetals#gold#chinagold#goldprices#jewelryprices#marketnews

Crypto M - Crypto News

@CryptoM · Post #65377 · 13.04.2026 г., 03:06

🚀 PRECIOUS METALS | Chinese Gold Jewelry Prices Remain Stable On April 13, Jin10 reported that the prices of gold jewelry in China have shown little change compared to last Friday. According to Jin10, several brands have maintained their pricing within the range of 1,445 yuan per gram to 1,450 yuan per gram. #preciousmetals#gold#goldjewelry#China#goldprices#stableprices#Jin10

Crypto M - Crypto News

@CryptoM · Post #65321 · 12.04.2026 г., 22:56

🚀 PRECIOUS METALS | Gold Prices Drop 2% Following U.S. Naval Blockade Order Gold prices fell by 2% to approximately $4,650 per ounce after U.S. President Donald Trump ordered a naval blockade of the Strait of Hormuz. According to Jin10, this decision came after peace talks between the U.S. and Iran failed over the weekend in Pakistan, unable to convert a fragile ceasefire into lasting peace following six weeks of conflict in the Middle East. The surge in energy prices has heightened inflation risks, increasing the likelihood that central banks may delay rate cuts or even raise rates. This development poses a bearish factor for non-yielding gold, which typically benefits when borrowing costs are lower. #Gold#PreciousMetals#GoldPrices#USPolitics#NavalBlockade#StraitOfHormuz#Inflation#EnergyPrices#InterestRates#MiddleEastConflict

Crypto M - Crypto News

@CryptoM · Post #64787 · 09.04.2026 г., 23:54

🚀 PRECIOUS METALS | Gold Prices Decline Amid Ongoing Inflation Worries Gold prices have experienced a slight decline as concerns over persistent inflation continue to influence market sentiment. Wall Street Journal (Markets) posted on X that the precious metal's value is being affected by ongoing fears of inflation, which remain a significant factor for investors. The market is closely monitoring economic indicators and central bank policies that could impact inflation rates. As these concerns persist, gold's appeal as a hedge against inflation is being tested, leading to fluctuations in its price. Investors are advised to stay informed about economic developments that may affect the precious metals market. #Gold#PreciousMetals#Inflation#MarketTrends#Investing#EconomicIndicators#CentralBank#FinancialMarkets#HedgeAgainstInflation#GoldPrices

Crypto M - Crypto News

@CryptoM · Post #65396 · 13.04.2026 г., 04:55

🚀 PRECIOUS METALS | Swiss Bank Reacquires Gold Amid Market Recovery Swiss Bank has resumed purchasing gold after previously reducing its holdings due to market downturns triggered by the Iran war. According to Jin10, the bank had significantly cut its gold holdings from about 10% to 3% of its portfolio. Despite the challenges, Swiss Bank maintains a positive long-term outlook for gold and is gradually reintegrating it into client investment portfolios. Since the onset of the conflict, gold prices have dropped sharply due to concerns over higher interest rates and liquidity constraints. The bank's gold holdings have now increased to approximately 6% of its portfolio. Swiss Bank anticipates that gold prices will rise to $6,000 per ounce by the end of this year, driven by structural demand factors such as central bank purchases, fiscal deficit concerns, and geopolitical tensions. #PreciousMetals#Gold#SwissBank#MarketRecovery#Investment#Geopolitics#CentralBank#FiscalDeficit#GoldPrices#PortfolioManagement

Crypto M - Crypto News

@CryptoM · Post #65333 · 13.04.2026 г., 00:13

🚀 PRECIOUS METALS | U.S. Inflation and Fed Rate Cut Expectations Impact Gold Prices On April 13, Jin10 reported that a research note from CITIC Securities highlighted the significant rise in U.S. overall inflation for March, driven by soaring oil prices, while core inflation remained moderate. According to Jin10, CITIC Securities anticipates minimal risk of secondary inflation in the U.S. and suggests that April's CPI may continue to show elevated growth due to compensatory increases in rental inflation. If oil prices decline slowly, U.S. CPI could remain above 3% year-on-year for the rest of the year. CITIC Securities also forecasts a 25 basis point rate cut by the Federal Reserve within the year, which may lead to a weaker U.S. dollar in the near term. This scenario could create liquidity-driven recovery opportunities for gold prices. Additionally, U.S. equities might benefit from improved risk appetite, while U.S. Treasury yields may lack sufficient downward momentum due to economic fundamentals. #PreciousMetals#USInflation#FedRateCut#GoldPrices#CITICSecurities#OilPrices#CoreInflation#CPI#USDollar#USEquities#USTreasuryYields