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

Резултати

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

Пребарај: #anc

当前筛选 #anc清除筛选
CRYPTO SIGNALS FREE

@crypto_vip_signals_free · Post #1228 · 10.05.2022 г., 02:23

#OGN +2100% #ANC +1600% #LIT +1800% #CELR +1500% We will update your investment strategy during the current best market and give you peace of mind that it will generate huge profits for you 😎😎. Chance is still huge!! @Cryptomathh

🇿🇦On July 21, we honor the legacy of Albert John Luthuli (1898–1967) — South African political leader, anti-apartheid activist, and president of the African National Congress (ANC). 🏆 In 1960, Luthuli became the first African recipient of the Nobel Peace Prize for his unwavering commitment to nonviolent resistance against racial oppression in apartheid South Africa. ✊ His moral leadership, courage, and commitment to equality continue to inspire generations. 💬 "I am a man of peace. My country can be free—without violence." 🕊 We remember. #AlbertLuthuli#SouthAfrica#NobelPeacePrize#HumanRights#AntiApartheid#History#Freedom#ANC

Мудрая птица 🦜

@mudrayaptitsa · Post #11703 · 24.03.2026 г., 13:27

On 23 March 2026, Ambassador of Russia to South Africa Roman Ambarov attended a Day of Reflection on Resistance and Liberation Heritage in commemoration of the Battle of Cuito Cuanavale at Freedom Park in Pretoria. The keynote address was delivered by Deputy Minister of Sport, Arts and Culture of South Africa, Hon. Ms Peace Mabe. Among the participants were Hon. Ms Nomvula Mokonyane, First Deputy Secretary-General of the African National Congress, as well as heads of diplomatic missions from Cuba, Angola, and Namibia, ANC representatives, and veterans of the Battle of Cuito Cuanavale. 🎙 Addressing the participants, Ambassador Roman Ambarov emphasized that the Battle of #CuitoCuanavalewasa turning pointof the Civil War in Angola. The victory of the People’s Armed Forces of Liberation of Angola contributed directly to the peace process in Namibia and helped pave the way for the eventual liberation of South Africa. “Cuito Cuanavale became a symbol of resistance against oppression. It demonstrated that even in the face of overwhelming force, the determination of people fighting for their rights cannot be defeated. It was here that the tide began to turn - not only in Angola, but across the region. The role played by the Soviet Union in supporting Angola during this difficult period remains an important part of this history. Through the various means of assistance and political support, it contributed to strengthening the defence of Angola’s sovereignty. Soviet advisers worked alongside Angolan and Cuban forces, sharing knowledge, resources, and a belief in a just cause. But what truly defined this moment was solidarity to fight together against the colonial yoke. It was the understanding that the struggle of one people is the concern of all humanity. The fight in Angola echoed the voices of those resisting apartheid in South Africa and colonial rule in Namibia. It was one struggle, fought on many fronts,” the Russian Ambassador said. As part of the event, Roman Ambarov laid wreath to the Russian section of the Wall of Names in memory of Soviet military specialists who participated in conflicts in Southern Africa. ℹ️ The Battle of Cuito Cuanavale (August 1987 – March 1988) was a decisive engagement of the Angolan Civil War and a crucial step in the struggle for independence of the countries of Southern Africa from colonialism and apartheid. During the battle, the People’s Armed Forces of Liberation of Angola backed by #USSR, #Cuba, People’s Liberation Army of #Namibia, African National Congress (#ANC) and others defeated the combatants of the Angolan “UNITA” party and the racist regime of the Republic of South Africa supported by the US. #RussiaSouthAfrica#AmbassadorAmbarov

🎧Как выбрать наушники и сохранить слух? Взгляд оториноларинголога ЦКБ ГА Современный ритм жизни невозможно представить без наушников: музыка, аудиокниги, бесконечные онлайн-переговоры. Однако с медицинской точки зрения бесконтрольное использование гаджетов таит в себе серьезные риски. 🔊 Длительное прослушивание на высокой громкости, особенно в условиях внешнего шума (в метро или на борту самолета), может привести к акустической травме, стойкому снижению слуха и появлению постоянного шума в ушах. Чтобы защитить свои уши в шумной обстановке, крайне важно учитывать вид шумоподавления. Это позволит вам слушать контент на более безопасной громкости. 👩‍⚕️Выделяют два основных типа шумоподавления: ◼️Активное шумоподавление (ANC) Самый эффективный и безопасный для слуха вариант в условиях городского шума. 🔹 Наушники «слушают» окружающий шум через встроенные микрофоны. 🔹 Процессор мгновенно генерирует звуковую волну с противоположной шуму фазой. 🔹 Волны накладываются друг на друга и взаимоуничтожаются — вы слышите только чистый звук без помех. ◼️Пассивное шумоподавление (PNC) Достигается исключительно за счет механической конструкции и плотности посадки наушников. Уровень звукоизоляции зависит от форм-фактора (в порядке убывания эффективности): ▫️ Полноразмерные (over-ear) — обеспечивают лучшую защиту. ▫️ Накладные (on-ear). ▫️ Внутриканальные (IEM) — «затычки». ▫️ Вкладыши (earbuds) — звукоизоляция практически отсутствует. 🚇Рекомендации врача: Для поездок в метро и прогулок по шумным улицам идеальным выбором станут ANC-наушники или сочетание активного и пассивного шумоподавления. ✅ Это позволит вам существенно снизить громкость воспроизведения и предотвратить пагубное воздействие звукового давления на нежные структуры внутреннего уха. Берегите свой слух! #ЦКБГА#Оториноларинголог#КсенияНиколаевнаБганцева#ЛОР#ЗдоровьеСлуха#КакВыбратьНаушники#Шумоподавление#ANC#Профилактика#Медицина