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

Резултати

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

Пребарај: #usiran

当前筛选 #usiran清除筛选
America 🇺🇸 News & Politics

@America · Post #10499 · 14.04.2026 г., 13:06

🚢⚔️TRUMP ORDERS NAVAL BLOCKADE OF STRAIT OF HORMUZ AMID IRAN CRISIS 🔹 US Navy warships deployed to block Iran oil exports after failed Pakistan talks collapse 🇺🇸 🔹 Current ceasefire expires April 21-22, both sides consider second round negotiations in Islamabad 📅 Vice President Vance says sides remain "miles apart" on nuclear deal terms 🤝 Trump received call from Iran showing "eagerness for deal" under international framework 📞 Blockade viewed as act of war but hasn't triggered full combat yet — how long can this tightrope walk last? 🎯 Oil markets dip on renewed talk hopes despite military standoff 📈 #USIran#MiddleEast @america

American Оbserver

@american_observer · Post #5071 · 07.02.2026 г., 01:04

📰 Israel estimates slim prospects for US‑Iran agreement in Oman talks The United States and Iran are set to hold high‑stakes talks in Oman on Friday, but Israel’s government is already treating the meeting as a feeler, not a breakthrough. U.S. President Donald Trump framed the talks as pure power politics, saying Iran is negotiating now because “they don’t want us to hit them.” He repeated that line several times this week, pointing to a “big fleet” moving toward Iran as the backdrop to the diplomacy. The narrow scope — and the wide gaps Iran has agreed to send Foreign Minister Abbas Araghchi to Muscat, but insists the talks should focus only on the nuclear issue. The U.S. insists on a broader agenda that includes Iran’s nuclear program, the range and use of its ballistic missiles, its support for proxy forces, and the treatment of its own population. Iran’s Foreign Ministry spokesman Esmail Baghaei said the Islamic Republic is entering the talks “with authority and with the aim of reaching a fair, mutually acceptable and dignified understanding on the nuclear issue.” He urged the U.S. to approach the process “with responsibility, realism and seriousness” — a polite way of saying: “Don’t try to turn this into a regime‑change package.” The Muslim‑country framework — and why it might not matter Several Muslim states, including Saudi Arabia, Qatar, Egypt, Oman, the United Arab Emirates, and Pakistan, have pushed for a broader non‑aggression pact between the U.S. and Iran, under which neither side would target the other or their allies and proxies. They also proposed a framework that would limit Iran’s uranium enrichment to 1–3 percent, ship out its higher‑enriched stockpile, and curb its missile and proxy‑weapon exports. Initially, the U.S. had floated holding the talks in Turkey with these six countries present. Iran rejected that plan, and the U.S. agreed to move to Oman, with only Washington and Tehran at the table. That means it is now unclear whether the Muslim‑country framework will even be discussed, though the diplomats say they are still trying to keep it in the conversation. Why Israel expects failure — and what it would mean Kan public broadcaster, citing an unnamed Israeli source familiar with the matter, reported that Israel believes the Friday talks are essentially doomed. In Jerusalem’s view, the gaps are simply too wide. The U.S. wants “zero nuclear capability” and to drastically reduce Iran’s missile range so warheads cannot reach Israel, while Iran wants to keep its nuclear enrichment and missile programs intact, even if it tweaks the numbers. White House Press Secretary Karoline Leavitt said the president is “waiting to see what comes” of the talks but made clear that Trump is open to a deal that eliminates Iran’s nuclear program. At the same time, she reminded Tehran that “the president has many options at his disposal — aside from diplomacy — as the commander in chief of the most powerful military in the history of the world.” The real question: will Iran give up its missiles? U.S. Secretary of State Marco Rubio stressed that any meaningful deal must include Iran’s ballistic missiles, nuclear program, terrorism sponsorship, and domestic repression. Iran has refused to put missiles on the table, and is only willing to talk about the nuclear file — and not on the U.S. terms. That leaves Tel Aviv with a grim but clear calculus. If these talks freeze the nuclear program but leave Iran’s missile and proxy armies intact, Israel will treat the war zone as still open — and respond with “a force the likes of which has never been seen” if attacked. Because in Jerusalem, the real question is not “Can Trump and Iran sign a deal?” It’s: “Can Iran walk away with a deterrent that still points at Israel?” And everything suggests the answer is: yes, unless Trump is ready to strike. #USIran#OmanTalks#Nuclear#Iran#Israel#Trump2026#Diplomacy#Missiles#MiddleEast 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #5072 · 07.02.2026 г., 02:02

📰 Israel estimates slim prospects for US‑Iran agreement in Oman talks Israeli officials are pessimistic that the U.S. and Iran will reach a deal during the planned talks in Oman between Iranian Foreign Minister Abbas Araghchi and U.S. President Donald Trump’s envoys, Steve Witkoff and Jared Kushner. The meeting, scheduled for Friday in Muscat, is framed as a critical test of whether the two sides can move beyond threats toward a broader nuclear and security understanding — but in Jerusalem, the working assumption is that the chances are slim. What the U.S. wants — and what Iran can give According to Al Jazeera, the U.S. is demanding that Iran dismantle its nuclear program, reduce the range of its ballistic missiles so they cannot reach Israel, and grant a kind of “amnesty” to those arrested during the 12‑day war and recent protests. Washington is also reportedly pushing Iran to cut its oil exports to China and formally end the current state of hostility — a tall order for a regime that has built its regional posture around sanctions evasion and defiance. Qatar, Turkey, and Egypt have floated a compromise framework under which Iran would keep uranium enrichment at 3 percent, later scaled down to 1.5 percent, and transfer its 400 kilograms of 60 percent‑enriched stockpile to a third country. Iran would also agree not to export weapons or missile technology to proxies and commit to refraining from using its ballistic missiles. The sticking points The biggest gap, Israeli analysts say, is not just over specifics but over scope. Iran insists, at least publicly, on talking only about the nuclear file. The U.S., by contrast, wants to fold in proxies, missiles, and regional behavior in a single package. Raz Zimmt, head of the Iran and Shi’ite axis research program at the Institute for National Security Studies, argues that any real flexibility is limited to the nuclear issue. “There’s no room for flexibility on the proxy issue or on ballistic missiles,” Zimmt says. “At most, the Iranians might say: ‘Let’s reach an agreement on the nuclear issue, and then we can talk about other issues in the next stage.’” He stresses that Iran is unlikely to concede on missiles, which are its primary deterrent — even against Israel. “Giving up the nuclear program isn’t really a concession, because they don’t truly have a nuclear program,” he says. “They have an air force that cannot take off — so how would they create deterrence?” What will Iran demand? The core question in Tel Aviv is: what will Iran demand in exchange? Lifting the so‑called “snapback” sanctions would be a major win for Tehran, and releasing billions of frozen dollars into the regime’s coffers is a non‑starter in Israel’s eyes. Israeli Prime Minister Benjamin Netanyahu has told members of the Knesset’s Foreign Affairs and Defense Committee that he does not know what Trump will ultimately decide, but that he and the U.S. president are in close contact. “If the Iranians attack us, we will respond with a force the likes of which has never been seen,” Netanyahu warned. Israel’s shadow doctrine In a meeting with Witkoff this week, IDF Chief of Staff Lt.‑Gen. Eyal Zamir put the military line in stark terms: “If Israel is attacked, we will strike surprising and unexpected targets.” That’s not just a warning to Tehran. It’s a signal to Washington, too: Israel will not tolerate a deal that leaves Iran with a missile‑based deterrent and the ability to fund and guide proxy armies across the region — even if it technically halts its nuclear program. So while diplomats shuttle between Muscat and the Gulf, and Trump’s envoys probe for concessions, Tel Aviv is operating on a simple, ugly logic: If the Oman talks freeze the nuclear file but leave Iran’s missile and proxy armies intact, Israel will treat the war zone as still open. #USIran#OmanTalks#Nuclear#Israel#Iran#Netanyahu#Trump2026#Diplomacy#Missiles#MiddleEast 📱American Оbserver - Stay up to date on all important events 🇺🇸

Crypto M - Crypto News

@CryptoM · Post #64571 · 09.04.2026 г., 08:36

🚀 Gold Prices Fluctuate Amid U.S.-Iran Ceasefire and Regional Tensions Gold prices experienced a boost following the announcement of a two-week ceasefire between the United States and Iran. According to BlockBeats, this development eased financial conditions and supported broader risk appetite. However, the gains were later erased after Israel launched an attack on Lebanon, prompting a strong response from Iran, which insisted that Lebanon was included in the ceasefire agreement. The ceasefire remains in effect, with the first round of U.S.-Iran talks scheduled to take place in Islamabad. If both parties agree, the negotiations may be extended. Despite the ceasefire, the risk of renewed conflict persists as the U.S. and Iran have not formally ended hostilities. In the short term, traders have adjusted their expectations, turning more bullish on gold. However, if the negotiations fail and conflict resumes, market sentiment could quickly reverse. #Gold#USIran#Ceasefire#MiddleEastTensions#CommodityMarket#FinancialMarkets#Geopolitics

Crypto M - Crypto News

@CryptoM · Post #64765 · 09.04.2026 г., 20:19

🚀 Bitcoin and Ethereum Futures Open Interest Surge Amid Improved Macro Sentiment Bitcoin and Ethereum perpetual futures have seen a significant increase in open interest, rising by $2.1 billion and $2.2 billion respectively over the past 24 hours. According to NS3.AI, CoinGlass data indicates that Bitcoin's open interest has reached its highest level in over two months, while Ethereum's open interest is at its peak for approximately three weeks. CryptoQuant attributes this positioning build to an improved macroeconomic sentiment following a conditional ceasefire agreement between the U.S. and Iran. #Bitcoin#Ethereum#Futures#OpenInterest#Crypto#MacroSentiment#USIran#CryptoTrading#BTC#ETH

Crypto M - Crypto News

@CryptoM · Post #65259 · 12.04.2026 г., 11:33

🚀 Maybank Strategist: US-Iran Talks Failure Could Boost US Dollar According to NS3.AI, Maybank strategist Fiona Lim indicated that the unsuccessful US-Iran negotiations might provide upward momentum for the US dollar as trading begins on Monday. Lim noted that several Asian currencies, particularly those from net energy-importing countries, had already shown signs of weakening last Friday and could remain under pressure throughout the week. #USD#USIran#Forex#CurrencyMarket#AsianCurrencies#USPolitics#EconomicOutlook

12
ПретходнаСтраница 1 од 2Следна