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

Резултати

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

Пребарај: #iom

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

@addisstandardeng · Post #21420 · 17.02.2026 г., 05:44

News: Over 529,000 refugees return to #Sudan in two years, UN says More than 529,000 refugees have returned to Sudan from neighbouring countries over the past two years, according to the International Organization for Migration (#IOM). In a report released on Sunday, the agency said it had registered 529,661 people who crossed back into Sudan between January 2024 and December 2025. Sudan has been gripped by conflict since April 2023, when fighting erupted between the Sudanese army and the Rapid Support Forces (RSF) over the integration of the paramilitary group into the armed forces. The war has triggered what the United Nations describes as one of the world’s worst humanitarian crises, with tens of thousands reported killed and around 13 million people displaced. Approximately 4.5 million people fled to neighbouring countries during the conflict and are considered refugees, according to recent UN .... https://www.middleeastmonitor.com/20260216-over-529000-refugees-return-to-sudan-in-two-years-un-says/

Hashtags

Addis Standard

@addisstandardeng · Post #21027 · 09.01.2026 г., 14:17

News: One-Third of #Sudan’s population displaced in 1,000 days of conflict, #IOM says Nearly one in three people in Sudan has been displaced internally or across borders over the past 1,000 days of conflict, marking the largest displacement crisis in the world, according to the International Organization for Migration (IOM). In a statement, IOM said an average of five displacement-triggering events occurred each week since fighting erupted on 15 April 2023, devastating communities and uprooting millions. The organization reported that 743 incidents have triggered displacement, including 524 conflict-related events and 219 natural hazards such as floods and fires. IOM data show that more than 15 million people have been forced from their homes, with 11.58 million displaced inside Sudan and around four million fleeing across borders at the peak of the crisis. The conflict has ... https://web.facebook.com/AddisstandardEng/posts/pfbid024AJ4oLUYMTu3M13vCpNyUwTBCKqwaRquc8JCJcxXiGr7to3Zh4ChVSp32zrDRW2el

Hashtags

NIHOL CENTER

@nihol_ngo · Post #765 · 10.11.2022 г., 10:23

​​27–28 октября 2022 г., Алматы, Казахстан Данное мероприятие проводится в рамках регионального проекта Международной организации по миграции «Защита уязвимых мигрантов с особым акцентом на расширение прав и возможностей женщин в контексте миграции в Центральной Азии» #iom#nihol#узбекистан#ташкент

NIHOL CENTER

@nihol_ngo · Post #763 · 10.11.2022 г., 10:15

Визит делегации Узбекистана в Казахстан Проведение обучения на местах и анализа выполнения межправительственных соглашений в области трудовой миграции. #iom#nihol#узбекистан#ташкент

Addis Standard

@addisstandardeng · Post #21822 · 24.03.2026 г., 16:06

News: #Ethiopia migration surges 18% in 2025 as economic hardship, smuggling shifts drive flows; Eastern Route turns deadliest on record Outgoing #migration from Ethiopia along the #Eastern Route rose sharply in 2025, with total tracked movements increasing by 18% to more than half a million, underscoring growing economic pressures and evolving smuggling dynamics, the International Organization for Migration (#IOM) said. Read more: https://addisstandard.com/?p=56046

Addis Standard Amharic

@addisstandardamh · Post #7987 · 26.03.2026 г., 17:35

ዜና፡ #በጂቡቲ የባህር ዳርቻ ስደተኞችን አሳፍራ ስትጓዝ የነበረ ጀልባ በመስጠሟ የዘጠኝ ሰዎች ህይወት ማለፉን፣ በርካቶች የገቡበት አለመታወቁ ተገለጸ ኢትዮጵያውያን ወደ #አረብ ሀገራት ለመሰደድ በብዛት የሚጠቀሙበት መንገድ መሆኑ በሚገለጸው የጂቡቲ መስመር ላይ ስደተኞችን አሳፍራ ስትጓዝ የነበረ አንድ ጀልባ በመስጠሟ ዘጠኝ ስደተኞች ሲሞቱ ሌሎች 45 ደግሞ የገቡበት አይታወቅም ሲል ዓለም አቀፉ የስደተኞች ድርጅት (#IOM) አስታወቀ። አደጋው የተከሰተው መጋቢት 15 ቀን 2018 ዓ.ም ሌሊት በሰሜናዊቷ #የኦቦክ ከተማ አቅራቢያ መሆኑን የጠቆመው የፈረንሳይ ዜና ወኪል (AFP) ጀልባዋ በምትሰምጥበት ወቅት 320 ሰዎች ተጭነውባት እንደነበር ይታመናል ሲል የመንግስታቱ ድርጅት የስደተኞች ኤጀንሲ መግለጹን ጠቁሟል። የበርካቶች የገቡበት እስካሁን ባለመታወቁ የነፍስ አድን ጥረቶች እንደቀጠሉ መሆናቸውንም አስታውቋል። በዓለም አቀፉ የስደተኞች ድርጅት (IOM) የቅርብ ጊዜ ሪፖርት እንዳመለከተው፣ በምስራቁ መስመር ከኢትዮጵያ የሚደረገው ስደት እ.ኤ.አ. በ2025 በ18 በመቶ የጨመረ ሲሆን፣ ይህ እያሽቆለቆለ የመጣውን የኢኮኖሚ ጫና እና የተደራጁ የሰዎች አዘዋዋሪዎችን መበራከት የሚያሳይ ነው። ሙሉውን ያንብቡ: https://addisstandard.com/Amharic/?p=11542

NIHOL CENTER

@nihol_ngo · Post #271 · 21.12.2020 г., 05:32

Международный форум на тему " Новые тенденции миграции в условиях пандемий, управление миграцией и защита мигрантов" https://fb.watch/2vUtaB3Pm_/ #мыпротивнасилия#насилие#стопнасилию#iom#nihol#узбекистан#ташкент

Addis Standard

@addisstandardeng · Post #21847 · 26.03.2026 г., 16:49

News: Nine dead, dozens missing in #Djibouti shipwreck as #Ethiopian migrants dominate risky route Nine migrants have died and 45 others remain missing after a boat sank off the coast of Djibouti this week, according to the International Organization for Migration(#IOM), in the latest tragedy along a route heavily used by Ethiopian migrants, AFP reported. The #UN migration agency said the incident occurred overnight on 24 March near the northern town of #Obock, with 320 people believed to have been on board at the time of the shipwreck. Rescue efforts are ongoing as dozens remain unaccounted for. The disaster underscores the continued risks faced by Ethiopian migrants, who make up the majority of those traveling along the Eastern Route, a perilous journey from the Horn of Africa across the Red Sea toward #Yemen and onward to #Gulf_states in search of work. Read more: https://addisstandard.com/?p=56116

Мулоқоти вазир бо роҳбари Дафтари минтақавии Созмони байналмилалии муҳоҷират (IOM) барои Аврупо ва Осиёи Марказӣ 5 августи соли 2025 вазири корҳои хориҷии Ҷумҳурии Тоҷикистон Сироҷиддин Муҳриддин бо роҳбари Дафтари минтақавии Созмони байналмилалии муҳоҷират барои Аврупо ва Осиёи Марказӣ Артур Эркен дар ҳошияи Конфронси сеюми Созмони Милали Муттаҳид оид ба Гурӯҳи кишварҳои рӯ ба тараққии маҳсур ба хушкӣ дар шаҳри Авазаи Туркманистон мулоқот анҷом дод. #Тоҷикистон#Муҳоҷират#Ҳамкорӣ#СММ#Аваза2025 Встреча Министра с Региональным Директором Офиса Международной организации по миграции (IOM) для Европы и Центральной Азии 5 августа 2025 года Министр иностранных дел Республики Таджикистан Сироджиддин Мухриддин встретился с Главой регионального Офиса Международной организации по миграции (IOM) Артуром Эркеном на полях Третьей Конференции ООН по развивающимся странам, не имеющим выхода к морю, в городе Аваза, Туркменистан. #Таджикистан#Миграция#Сотрудничество#ООН#Аваза2025 Meeting of the Minister with the Regional Director of IOM Office for Europe and Central Asia On August 5, 2025, Sirojiddin Muhriddin, Minister of Foreign Affairs of the Republic of Tajikistan, met with Arthur Erken, Regional Director of the IOM Office for Europe and Central Asia, on the margins of the Third United Nations Conference on Landlocked Developing Countries (LLDC3) in the city of Avaza, Turkmenistan. #Tajikistan#IOM#Cooperation#UN#Avaza2025 @mfa_tj