Недавно делал быстрый прототип асинхронного приложения в котором требовалось вызывать много синхронного кода. Да, я знаю, что это не лучший дизайн, но нужно было быстрое решение на один процесс и без очередей. Поэтому я выполнял код в потоках.
Выглядело это примерно так:
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
News: #HRW condemns #EMA decision to revoke Addis Standard license, says move reflects growing repression of press freedom in Ethiopia
The Human Rights Watch (HRW) has condemned the #Ethiopian government’s decision to revoke the operating license of Addis Standard, warning that the move risks silencing one of the country’s last independent media institutions ahead of national elections.
On 24 February, the Ethiopian Media Authority (EMA) announced that it had revoked the outlet’s operating license, three months before scheduled national polls. HRW said the measure reflects what it described as authorities’ renewed reliance on “the authoritarian playbook.”
Founded in 2011, Addis Standard has been a prominent independent voice in what rights groups describe as an increasingly restrictive media environment, publishing in-depth reporting on politically sensitive issues. HRW noted that the outlet and its staff have faced repeated pressure over the years....
Read more: https://addisstandard.com/?p=55410
🇰🇿🌈В упомянутой истории относительно защиты Евгением Жовтисом журналиста Сергея Дуванова, обвиненного в изнасиловании несовершеннолетней, интересно то, что Жовтис в 1993 году создал и возглавил Казахстанское международное бюро по правам человека и соблюдению законности.
Изначальное называние — Казахстанско-американское бюро по правам человека и соблюдению законности, а спонсируется оно — да, это ожидаемо — фондом «Сорос-Казахстан».
Дуванов же в начале нулевых был все в том же КПБПЧ редактором бюллетеня по правам человека «в Казахстане и мире». После чего, как Гульшат Бажкенова после работы на «Радио Азаттык», он нашел возможность открыть свою оппозиционную газету «Время зеро», а затем Eurasia.org, где увлеченно оппозиционировал и ругательски ругал правительство.
Интересно и то, что КМБПЧ в лице своего основателя Жовтиса и Human Rights Watch (которая также получает деньги от Сороса) в этот раз снова в тандеме ринулись на защиту попираемых петицией прав ЛГБТ. Перед этим они «продавили» правительство РК зарегистрировать квир-феминистскую «Феминиту».
Даже удивительно (нет), как за защитой интересов меньшинств в Казахстане всегда стоит американское финансирование.
#Сорос#HRW#КМБПЧ
News: Human Rights Watch flags deepening conflict, shrinking civic space in #Ethiopia in 2025
Civilians across much of Ethiopia faced overlapping humanitarian, security, and human rights crises in 2025, as armed conflicts persisted in several regions and the government intensified restrictions on independent media and civil society ahead of the 2026 elections, Human Rights Watch (#HRW) said in its annual country review released on Wednesday, 4 February 2026.
In its World Report 2026: Ethiopia Events of 2025, the international rights organization documents continued hostilities in #Amhara and parts of #Oromia, renewed instability linked to internal tensions in #Tigray, and fragile relations between the federal government and Eritrea, alongside a broader crackdown on dissent, stalled justice efforts, and worsening economic and social pressures.
According to HRW, fighting between federal forces and the Fano militia continued throughout 2025 in Amhara, with....
Read more: https://addisstandard.com/?p=55002
#HRW urges #UN child rights body to press #Ethiopia to suspend Lega Dembi gold mine over #child health risks
Human Rights Watch (HRW) has called on the United Nations Committee on the Rights of the Child to urge Ethiopia to suspend operations at the Lega Dembi gold mine in Oromia, citing long-standing pollution and serious health impacts on children living nearby.
In a statement ahead of the committee’s upcoming review of Ethiopia’s child rights record, HRW said communities around the country’s largest gold mine have for years reported grave health problems, including children born with long-term conditions, miscarriages, and stillbirths. Several studies have found elevated levels of toxic substances, including cadmium, mercury, lead, and arsenic, linked to the mine.
The Ethiopian government suspended Lega Dembi between 2018 and 2021 following public protests over pollution and pledged to reopen it only after environmental concerns were addressed.
https://addisstandard.com/?p=54692
News: Human Rights Watch accuses #Sudanese army, allies of arbitrary detention, torture
Human Rights Watch (#HRW) has accused forces affiliated with the Sudanese Armed Forces (#SAF) of carrying out widespread arbitrary detentions, torture, and ill-treatment of civilians in areas under their control.
In a report released Tuesday, HRW said civilians were targeted on allegations of collaborating with the Rapid Support Forces (#RSF), often based on ethnicity, perceived political affiliation, or humanitarian work.
The organization warned that such abuses, including unlawful detention and torture, may amount to war crimes and crimes against humanity.
The report, based on interviews with 28 individuals conducted between June 2025 and February 2026, documents cases of incommunicado detention, enforced disappearances, and deaths in custody.
Former detainees and witnesses described.........
https://www.facebook.com/AddisstandardEng/posts/pfbid023d7PDtTn4vknNgegTfntDVzs5Ctw9tn2jvHVs81npRew6gBad4nbaH9dh6JKUhnzl
News: #UN committee urges Ethiopia to address pollution at Lega Dembi gold mine; HRW cites child health concerns
The #United_Nations Committee on the Rights of the Child has urged the #Ethiopian government to “urgently and effectively” address environmental and health impacts linked to the Lega Dembi Gold Mine, following complaints from residents and new findings highlighting harm to children, according to a statement by Human Rights Watch(#HRW).
The call follows reports from residents living near the mine in the #Oromia Region, who have for years complained of health problems including miscarriages, stillbirths, and children born with long-term illnesses.
Human Rights Watch cited findings from the Ethiopian civic group Kontomaa Darimu Alliance, which documented cases of child illness, deaths, and pregnancy complications in communities surrounding the mine.
Read more: https://addisstandard.com/news-un-committee-urges-ethiopia-to-address-pollution-at-lega-dembi-gold-mine-hrw-cites-child-health-concerns/
News: Rights group urges #Saudi authorities to halt #executions of Ethiopians, calls for #Addis_Abeba’s immediate intervention as three already executed
“at least 65 Ethiopian migrants are at imminent risk of execution”..., with three already executed on 21 April.
“Saudi Arabia’s willingness to execute foreign migrants for nonviolent offences following trials that denied them basic due process reflects a profound disregard for their rights and lives,” said Nadia Hardman, senior refugee and migrant rights researcher at #HRW.
https://addisstandard.com/?p=56677
News: #HRW urges stronger #EU action on Ethiopia, warns against “premature normalization” amid ongoing abuses
Human Rights Watch (HRW) has renewed its call for the #European_Union to adopt clearer and enforceable human rights benchmarks in its engagement with #Ethiopia, warning that recent diplomatic and financial normalization risks undermining accountability efforts in the country.
The warning comes amid continuing concerns over violations linked to past and ongoing conflicts in Ethiopia, including in Tigray, Oromia, and Amhara regions, as well as growing political tensions ahead of the country’s scheduled elections in June.
In an interview with Addis Standard, Laetitia Bader, Deputy Africa Director at Human Rights Watch, said the EU’s decision to resume budget support to Ethiopia despite unresolved accountability concerns raises “serious questions” about its commitment to previously stated conditions tied to the 2022 #Pretoria peace agreement.
https://addisstandard.com/?p=56623
#Human Rights Watch urges leaders at #AU summit to address #Ethiopia crisis
Human Rights Watch (#HRW) has called on African and international leaders attending the 39th African Union (AU) summit in Addis Abeba to speak out on the deteriorating human rights situation in Ethiopia and the fragile peace in the #Tigray region.
In a statement released today, the rights group highlighted renewed fighting in late January between the Ethiopian army and Tigrayan forces in central and southern #Tigray, which has caused widespread displacement.
HRW also pointed to ongoing hostilities in the #Amhara region, where Ethiopian authorities have accused neighboring Eritrea of backing armed groups.
The group said AU leaders should not fear alienating Ethiopia, but instead use the summit as an opportunity to prioritize civilian protection.
https://addisstandard.com/human-rights-watch-urges-leaders-at-au-summit-to-address-ethiopia-crisis/?amp=1
Official Statement From Office Of The Welkait Tegede Setit Humera Zone Administration. Read more.
https://borkena.com/2026/04/23/ethiopia-the-welkait-tegede-setit-humera-zone-administration-response-to-human-rights-watch/#Ethiopia#News#Welkait#Walqait#HRW#HumanRightsWatch
Силы #Кыргызстана и #Таджикистана причастны к убийствам и ранениям гражданских лиц в ходе скоротечного, но ожесточенного пограничного вооруженного конфликта в сентябре 2022 года.
Эти эпизоды могут быть приравнены к военным преступлениям.
Семьям жертв должны возместить ущерб и обеспечить правосудие, что послужит началом на пути к урегулированию продолжающегося конфликта на условиях уважения и соблюдения прав человека.
Оба государства должны оперативно расследовать нарушения со стороны своих сил, привлечь виновных к ответственности и возместить ущерб пострадавшим. Международные партнеры должны поддержать эти усилия.
Подробнее в материале #HRW по ссылке в шапке профиля.
#kyrgyzstan#tajikistan ##кыргызстан#таджикистан#правачеловека#конфликт#humanrights#humanrightswatch#pamirdailynews