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

Резултати

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

Пребарај: #nama

当前筛选 #nama清除筛选
Borkena

@borkena · Post #6191 · 21.04.2026 г., 13:07

በሲቪል ሰርቪስ ከ150 በላይ የሀሰተኛ የትምርህርት ማስረጃ ተገኘ መባሉ ፤ በመንግስት ደጋፊነት የሚተቸው አብን መዋቅራዊ በደል ድርሷል ማለቱ እና ሌሎች ዜናዎች ፡፡ https://youtu.be/y4-9eSmywW8#Ethiopia#News#Amharic#EthiopianNews#fakecredential#education#NAMA

Addis Standard

@addisstandardeng · Post #21510 · 24.02.2026 г., 09:10

News: #NAMA, #ADPM welcome House of Federation decision to hold elections in five districts outside #Tigray oversight The National Movement of #Amhara (NAMA) and the Amhara Democratic Force Movement (ADPM) have welcomed a recent decision by the House of #Federation to conduct elections in five districts outside the oversight of the Tigray regional authorities, pending the resolution of their constitutional status. In separate statements issued following emergency executive meetings, both organisations said the decision provides a legal response to long-standing questions of political participation and identity in the “contested” electoral districts, while also raising concerns about its implementation. NAMA said it respects the decision, which followed communication between the House of Federation and #NEBE, & described it as consistent with the spirit of the Pretoria Agreement. For its part, ADPM described the House’s move as “the beginning of historical.... Read more: https://addisstandard.com/?p=55369

Addis Standard

@addisstandardeng · Post #21287 · 03.02.2026 г., 07:48

#Ethiopia: MP Abebaw challenges peace talks with splinter armed groups Member of Parliament Dr. Abebaw Desalew of the National Movement of Amhara (#NaMA) has questioned Prime Minister #Abiy Ahmed over the federal government’s approach to peace negotiations and regional security, warning that talks with what he described as “splinter groups” have failed to bring tangible improvements on the ground. Dr. Abebaw raised the concerns during the 10th Regular Session of the 5th Year of the 6th Term of the House of Peoples’ Representatives (#HoPR), where MPs questioned the Prime Minister on the government’s six-month performance report. He said Ethiopia continues to face a pervasive lack of peace, particularly in conflict-affected regions including #Amhara, #Oromia, #Tigray, and #Gambella, while noting that serious human rights violations are also reported in regions without active armed conflict. “Even in areas not experiencing open conflict, members from the... Read more: https://addisstandard.com/?p=54927

📺 AnimeAction++

@animeactioz · Post #3981 · 25.04.2024 г., 16:21

Saijaku Tamer wa Gomihiroi no Tabi o Hajimemashita aka The Weakest Tamer Began a Journey to Pick Up Trash | 最弱テイマーはゴミ拾いの旅を始めました 📅Año 2024 País🇯🇵Japón 🎥Dirección#ShigeyasuYamauchi, #NaokiHoriuchi 📄Guion Katsuhiro Takayama. 📚Novelas#Honobonoru500, #Nama 🎼Música Kujira Yumemi 🎬Productora Studio Massket Género#SeriedeTV#Animación#Drama#Fantástico#Naturaleza Reparto | Trailer | Sinopsis ⏱Duración 23min. 🖥Resolución 720x400 🗣Idioma Japonés Subtítulos Latino Episodio01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 - 11 - 12 Suscripción a este Anime 👉🏻Aquí Índice de Animaciones 👉🏻Aquí