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

Резултати

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

Пребарај: #freethemall

当前筛选 #freethemall清除筛选
RNN Mirror

@Palresistmirror · Post #94964 · 19.05.2026 г., 16:37

🚨 The IOF arrested Palestinian activist and one of the Murabitat of Al-Aqsa Mosque, Nafisa Khweis, after storming her home in the town of At-Tur in occupied Al-Quds. #FreeThemAll

Hashtags

RNN Mirror

@Palresistmirror · Post #94935 · 18.05.2026 г., 02:08

🚨 Released prisoner Layan Nasser described the harsh conditions of 79 Palestinian female prisoners held by the occupation in "Damon" prison. Nasser reported that conditions are deteriorating, with the prisoners lacking even the most basic necessities. She noted that expectations for improved conditions following the so-called ceasefire have not been met, and the situation inside the prisons continues to worsen. #FreeThemAll

Hashtags

RNN Mirror

@Palresistmirror · Post #94795 · 14.05.2026 г., 19:31

🚨 Palestinian prisoner Hanan Barghouthi has been released from occupation prisons, after eight months of detention. Hanan is the sister of the liberated prisoner Nael Barghouthi, and the sister of the late national leader Omar Barghouthi "Abu Asef." #FreeThemAll

Hashtags

RNN Mirror

@Palresistmirror · Post #94758 · 13.05.2026 г., 19:17

🚨 Three pregnant Palestinian Prisoners—Amina Al-Tawil, Dana Judeh, and Manar Karaja—are being held under deteriorating conditions inside the "israeli" "Damon" prison. Current conditions inside the facility include: • Severe overcrowding and lack of essential supplies, with detainees forced to sleep on the floor. • Frequent IOF raids using sound grenades and physical assaults, resulting in fainting and health decline. • Deliberate medical neglect and denial of prenatal care and necessary examinations. • Degrading transport conditions and near-total isolation from humanitarian oversight. #FreeThemAll

Hashtags

RNN Mirror

@Palresistmirror · Post #94757 · 13.05.2026 г., 19:09

🚨 The Prisoners' Media Office reports that the administration of "Megiddo" prison has intensified repressive measures against prisoners in isolation, implementing new tools during raids and inspections. • Prisoners are subjected to degrading strip searches and constant intimidation, with strict surveillance and punishment surrounding lawyer visits. • Prisoners suffering from illness and the elderly face critical health conditions due to medical neglect and delayed treatment. • Prisoners Abdul Khaleq Al-Natsheh and Munadel Infia'at are facing dire health conditions amid ongoing weekly raids. • Violations, including the provision of substandard food, water cuts, and the denial of family communication, continue within the isolation sections of "Megiddo." #FreeThemAll

Hashtags

RNN Mirror

@Palresistmirror · Post #94745 · 13.05.2026 г., 15:26

🚨 The family of political prisoner Ibrahim Marwan Al-Sous, 22, has warned of a dangerous deterioration in his health status due to ongoing detention by the Palestinian Authority for approximately 18 months. Al-Sous suffers from several critical health conditions, including a foot injury, kidney failure requiring dialysis, abdominal and bladder stones, and facial nerve damage. The family reports that previous appeals for medical care have been ignored and are calling for immediate humanitarian intervention to secure his right to treatment. #FreeThemAll

Hashtags

RNN Mirror

@Palresistmirror · Post #94673 · 12.05.2026 г., 19:00

🚨 After 6 years of captivity, the Palestinian prisoner Qusay Marei has been released from the occupation prisons. Qusay was among those who assisted in the "Freedom Tunnel" operation from "Gilboa" prison in September 2021. He was initially arrested in June 2020 and sentenced to 1.5 years. Following the "Freedom Tunnel" operation, occupation authorities added a 4-year sentence, alleging he assisted the prisoners in digging. He recounts from his hospital bed that the prisoners are subjected to systematic beatings and physical violence, including dogs used by the occupation forces to attack the prisoners. #FreeThemAll

Hashtags

RNN Mirror

@Palresistmirror · Post #94651 · 12.05.2026 г., 17:54

🚨 BREAKING: The "israeli" Knesset voted to establish a special military court to try Palestinian prisoners who were abducted in the "Gaza envelope" during the events of October 7. The legislation, passed with 93 votes, mandates the following: • Establishment of a special military court in Al-Quds with the authority to impose the death penalty on Palestinian prisoners. • Relaxation of evidentiary rules, allowing for convictions based on superficial evidence. • Mandatory live broadcasting of trial proceedings in the presence of families of the occupation's casualties. • The law applies to approximately 250 prisoners held by the occupation. The Palestinian Prisoners’ Club stated that this law, which targets Palestinians accused of participating in October 7, establishes a punitive judicial framework that violates fair trial guarantees, international humanitarian law, and the prohibition of torture. The measure reinforces previous legislation authorizing the death penalty for Palestinian prisoners, further cementing the role of the zionist Knesset as an instrument of the colonial occupation apparatus. #FreeThemAll

Hashtags

RNN Mirror

@Palresistmirror · Post #94413 · 09.05.2026 г., 00:09

🚨Dr. Hossam Abu Safiya, director of Kamal Adwan Hospital in northern Gaza, remains held by the occupation since his arrest from the facility in December 2023. Released prisoners report that the 64-year-old physician has been subjected to systematic abuse within occupation prisons, including severe beatings, isolation, and use of attack dogs. Testimonies confirm he faces: • Prolonged restraint, sleep deprivation, and starvation. • Psychological and physical targeting, including gas attacks in his cell. • Denial of necessary medical care despite a critical deterioration in his health. #FreeThemAll

Hashtags

RNN Mirror

@Palresistmirror · Post #94307 · 07.05.2026 г., 00:38

🚨 Political prisoner Suleiman Al-Shami, from Jenin, is being subjected to severe torture and medical neglect at the Palestinian Authority's Al-Junaid prison in Nablus. Ever since his abduction, his health has deteriorated significantly. His father reports: • Severe burns on his feet and back. • Pelvic fractures sustained during his arrest. • A critical leg injury limiting mobility. Despite medical recommendations, the treacherous Palestinian Authority denies him care. Al-Shami has asked his family to cease visits due to fears of further torture and abuse by the PA. #FreeThemAll

Hashtags

RNN Mirror

@Palresistmirror · Post #94129 · 02.05.2026 г., 17:41

Dignity is taken by force! Sheikh Khader Adnan speaks on the streets of Ramallah in January 2022 on behalf of the prisoners fighting daily battles for your honor and dignity. Sheikh Khader, the hero of the battle of the empty intestines, affirmed that dignity cannot be bought or sold in support of hunger-striking prisoner Hisham Abu Hawwash. Hisham was victorious in his 141-day-long hunger strike in February 2022. Sheikh Khader, having reinvigorated the prisoners' movement with his numerous successful hunger strikes, ascended to martyrdom during his sixth one on May 2nd, 2023. Today, thousands of prisoners are in grave danger, as they could be executed at any time under the newly passed execution law. #FreeThemAll

Hashtags

RNN Mirror

@Palresistmirror · Post #94115 · 02.05.2026 г., 17:25

Who is Khader Adnan, the imprisoned resistance leader on his 81st day of hunger strike? (2/2) Following the battle of Saif Al-Quds in May 2021, a new era of the Palestinian prisoners movement inspired by Sheikh Khader Adnan was ushered in, characterized by dozens of successful hunger strikes, such as Hisham Abu Hawwash's 141-day strike. Sheikh Khader had utilized new tactics such as a refusal to take supplements or medical checkups, inspiring others. The terms of the equation of the battle are clear: the zionist courts are illegitimate and prisoners are held without charge or trial. Zionists insist on slow execution (assassination), in line with their founding genocidal principles, and try to draw out the hunger strikes of the steadfast prisoners as much as possible. This year, on February 5th, zionists kidnapped the free Sheikh Khader from his home in Jenin. He announced his hunger strike from that moment as he was carried away with his head held high. Unlike his 11 other arrests, the zionists brought charges against him this time, claiming that he belonged to the "terrorist" organization PIJ. Adnan views these charges as baseless, and in 2023, as in 2012, the strike continues. This strike has been the hardest one on his body. His health has again deteriorated significantly, and resistance factions have warned of a major response in the event of his martyrdom by assassination. Sheikh Khader is steadfast, but he requires the support of the Palestinian people and allies to earn his freedom. In the attached video video, the late martyr Ibrahim Al-Nabulsi, wanted at the time, is seen kissing Sheikh Khader's head and raising his hands in support of him, fearless in the face of the occupation that was chasing him. Khader Adnan's freedom requires global support and mobilization. It requires that supporters are unfazed by and proud of his stature as a resistance leader. #FreeThemAll

Hashtags

123•••67
ПретходнаСтраница 1 од 7Следна