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

Резултати

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

Пребарај: #tplf

当前筛选 #tplf清除筛选
Addis Standard

@addisstandardeng · Post #21267 · 31.01.2026 г., 18:15

#TPLF welcomes #AU call for restraint, reaffirms commitment to dialogue The Tigray People’s Liberation Front (TPLF) has welcomed a call by the Chairperson of the African Union Commission, Mahmoud Ali Youssouf, urging restraint amid renewed tensions in Ethiopia’s Tigray region, reaffirming that dialogue remains the only viable path to resolving outstanding issues with the federal government. In a letter sent late on Saturday and addressed to the AU Commission Chairperson, the TPLF said it appreciates the African Union’s engagement in support of peace and stability in Ethiopia, noting that it takes “positive note” of the AU’s concern over recent developments in Tigray. The party further expressed its readiness to engage constructively in any dialogue initiative facilitated by the African Union, including through the AU High-Level Panel on Ethiopia, aimed at advancing “peace, confidence-building, and reconciliation.” https://addisstandard.com/tplf-welcomes-au-call-for-restraint-reaffirms-commitment-to-dialogue/

Hashtags

Addis Standard

@addisstandardeng · Post #21623 · 05.03.2026 г., 15:34

News: #Tigray rebels say #Ethiopian troops preparing for war Ethiopian federal authorities are preparing "to wage a war against Tigray," a senior official from this northern regional state told AFP on Wednesday, raising fears of a new conflict. Tigray emerged in 2022 from a two-year war that saw federal forces, backed by militias and the Eritrean army, clash with rebels from the Tigray People's Liberation Front (#TPLF). The TPLF dominated Ethiopian politics for some 30 years before current Prime Minister Abiy Ahmed, a non-Tigrayan, took power in 2018. At least 600,000 people were killed in the conflict, according to estimates from the African Union. A ceasefire held for more than two years, but clashes between federal and Tigrayan forces broke out again in November 2025 and January 2026. Large numbers of federal troops have for several weeks been massed at the Tigray border, where.... https://web.facebook.com/AddisstandardEng/posts/pfbid023a9Gk4wS4Zc9q1exiF73ypsGSrQ1ubLT6Pg7Hv5gRNoJDmMEsv8KpNyvcM73Nq8il

Borkena

@borkena · Post #5214 · 08.11.2025 г., 03:01

TPLF Alleges Federal Gov’t “Carried Out Drone Strike on Tigray Forces” Read more. https://borkena.com/2025/11/07/tplf-alleges-federal-govt-carried-out-drone-strike-on-tigray-forces/#Ethiopia#TPLF#Afar

Addis Standard

@addisstandardeng · Post #21794 · 21.03.2026 г., 10:17

#Op_ed: Ghosts of Governance: Opposition paralysis, failure of political imagination in post-war #Tigray The most dangerous moment for a post-war society is when paralysis becomes normal, “a condition that has gripped Tigray for too long,” writes Getachew Gebrekiros Temare. He argues, “War destroyed infrastructure, displaced millions, and shattered institutions,” yet the deeper crisis remains political. Factionalism within the #TPLF and fragmentation among opposition parties have left society without coherent leadership. Opposition rhetoric often functions as controlled dissent rather than driving meaningful change. He notes, “The cumulative consequences of fragmentation, pseudo-analysis, and political hesitation are now impossible to ignore.” Getachew emphasizes that the solution requires “the emergence of a political movement grounded in public interest rather than personal ambition.” https://addisstandard.com/?p=55998

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