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

Пребарај: #usdebt

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

@CryptoM · Post #64964 · 10.04.2026 г., 12:30

🚀 Jamie Dimon Warns of Rising U.S. Debt Risks and Global Deficits Jamie Dimon has expressed concerns over the increasing risks associated with U.S. debt. According to NS3.AI, Dimon referenced a Congressional Budget Office forecast predicting that the debt-to-GDP ratio will escalate from the current 100% to 120% by 2036. He highlighted that global deficits are currently at 5%, despite the relatively healthy state of the global economy. Dimon also cautioned that a future downturn in the credit cycle could lead to higher-than-anticipated losses in leveraged lending. #USDebt#GlobalDeficits#DebtToGDP#CreditRisk#LeveragedLending#EconomicForecast

Crypto M - Crypto News

@CryptoM · Post #65332 · 12.04.2026 г., 23:51

🚀 Global Currency Order Restructuring May Lead to Long-Term Dollar Depreciation According to Jin10, a report by China International Capital Corporation (CICC) suggests that after the short-term factors boosting the dollar fade, the narrative of global currency order restructuring and the weakening of dollar hegemony may once again dominate market direction. The United States' continuous accumulation of net external debt increases its need for dollar depreciation. The uncertainty surrounding U.S. President Donald Trump's policies and the unresolved risks of dollar 'weaponization' also dampen market demand for U.S. assets. The new Federal Reserve Chair, Walsh, advocates for a 'balance sheet reduction' policy, which could objectively help restore the dollar's credibility if implemented. However, Walsh's policy is constrained by the resilience of the real economy and financial markets, as well as political limitations. Additionally, Trump's foreign, trade, and economic policies continue to negatively impact the dollar's credibility. Considering the overall impact of Walsh and Trump's policies, it is difficult to conclude that the dollar's credibility will improve in the future. We anticipate that the global currency order may continue to restructure, driving the dollar to maintain a long-term depreciation trend. #GlobalCurrencyOrder#DollarDepreciation#USDebt#DollarHegemony#FederalReserve#MonetaryPolicy#TrumpPolicies#CICCReport#FinancialMarkets#CurrencyRestructuring

Crypto M - Crypto News

@CryptoM · Post #65191 · 11.04.2026 г., 18:19

🚀 U.S. Public Debt Increases by $571.28 Billion, Reaching $38.969 Trillion The United States public debt has increased by approximately $571.28 billion this year, reaching a total of $38.969 trillion as of April 7, 2026. According to NS3.AI, this figure encompasses both debt held by the public and intragovernmental holdings. In an interview with NPR, JPMorgan Chase CEO Jamie Dimon expressed concerns that the growing debt burden could pose challenges, potentially leading to higher market rates and reduced demand for U.S. Treasurys. #USDebt#PublicDebt#USFinance#GovernmentDebt#EconomicNews#USMarkets#Treasury#DebtCrisis#JPMorgan#Macroeconomics

IELTS|Newspapers & Magazines|English

@emagzinewspars · Post #9341 · 15.10.2025 г., 01:52

#The_Barron's 🇺🇸📕[PDF]⬇️ 13 #October2025 #Weekly_Magazines For learning, for free(dom). @backupofmagazines In this issue, Oracle founder #LarryEllison takes center stage, betting big on #AIInvestment in what may be his boldest move yet. The issue unpacks market jitters over a tech-driven bull run, rising #Gold and #USDebt, and the resilience of #ESG investing. Insights span #Ferrari’s EV gamble, #ImmigrationEconomics, and potential Fed leadership shifts. For savvy investors, Barron’s explores where the smart money is heading—plus, a special “Guide to Wealth” offers survival strategies for volatility. #Oracle#StockMarket#EllisonUnbound#TechBubble#Barrons#RetirementPlanning