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

Резултати

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

Пребарај: #nablus

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

@Palresistmirror · Post #94833 · 15.05.2026 г., 14:37

🚨 Fahd Zaidan Oweis (15) ascended to martyrdom after he was shot and killed by the IOF in the town of Al-Lubban ash-Sharqiya, south of #Nablus. Glory to the martyrs.

Hashtags

RNN Mirror

@Palresistmirror · Post #94379 · 08.05.2026 г., 16:52

🚨 Settlers set fire to a Palestinian home near the entrance of the village of Al-Lubban ash-Sharqiya, south of #Nablus.

Hashtags

RNN Mirror

@Palresistmirror · Post #94335 · 07.05.2026 г., 18:00

🚨 The Committee of Families of Political Detainees in the West Bank reports critical violations and systematic abuse occurring within the Palestinian Authority's Al-Junaid Prison in #Nablus. • All prisoners are exposed to psychological and physical terrorism while in custody. • Documented cases include the severe torture of detainee Suleiman Al-Shami, who sustained burns on his feet due to brutal interrogation methods. • Over 70 political detainees remain imprisoned despite explicit court orders issued for their release. • The committee holds the security apparatus fully responsible for the physical and psychological safety of the detainees and demands their immediate, unconditional release.

Hashtags

RNN Mirror

@Palresistmirror · Post #94142 · 03.05.2026 г., 12:02

🚨 Nayef Firas Ziad Samaro (26 years old), has ascended to martyrdom after he was shot by the IOF during a military raid in #Nablus. The Palestinian Red Crescent reported a total of 45 injuries during the incursion into the city center. The casualties include: • 5 injuries by live ammunition, including the martyr. • 40 injuries due to tear gas inhalation, with 10 requiring hospitalization. Glory to the martyrs.

Hashtags

RNN Mirror

@Palresistmirror · Post #93798 · 24.04.2026 г., 16:09

🚨 The Commission of Prisoners and Ex-Prisoners Affairs warns of a systematic campaign of abuse against Palestinian prisoner Amjad Awad, held in "Gilboa" prison. Awad, from the town of Awarta in #Nablus, has been detained since April 2011 and is serving five life sentences and seven additional years. The Commission reported that IOF prison authorities are subjecting Awad to: • Systematic physical and psychological violence, including beatings with metal batons, causing fractures. • Deliberate targeting of his head and face, resulting in broken teeth. • Attacks with rubber-coated metal bullets. • Persistent violent raids on his cell. During a legal visit in February, prison authorities refused to remove his restraints, limiting the consultation to ten minutes and forcing him to communicate via a telephone handset placed on his shoulder. The Commission emphasizes that these conditions pose a severe and immediate threat to his life, amid ongoing retaliatory measures by the occupation.

Hashtags

Resistance News Network

@palestineresist · Post #93690 · 08.04.2026 г., 15:35

🚨 Settlers kidnapped the child Usayd Mahmoud Ghanem from the town of Qabalan, taking him to the "Avitar" settlement built on Jabal Sobeih in the town of Beita, south of #Nablus.

Hashtags

Resistance News Network Backup

@RNN_Backup · Post #62903 · 13.10.2024 г., 21:11

🚨 Confrontations have broken out between resistant youth and the IOF invading Beit Furik, east of #Nablus. The Palestinian Red Crescent reported dealing with two live bullet injuries and four tear gas injuries including a two-month-old infant. Resistant youth targeted an IOF vehicles with Molotovs.

Hashtags

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