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

Резултати

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

Пребарај: #ekolog

当前筛选 #ekolog清除筛选
EKOLOG.UZ| ENG

@ekologuzenglish · Post #11374 · 29.01.2026 г., 12:59

In recent years, systematic and mass cases of cruelty toward donkeys have sharply increased in Uzbekistan, particularly in the districts of Tashkent city. Another severe case was identified in Yangihayot District of Tashkent. The animal’s hindquarters were completely covered with wounds; it had been neglected for a long period and was found in a state of extreme suffering. This incident clearly indicates a failure to fulfill legal obligations toward animals and shows clear signs of cruelty. Practical experience demonstrates that owners actively use donkeys as labor force during the summer, and with the arrival of winter, abandon sick and exhausted animals on the streets. This is a direct consequence of irresponsibility and the absence of a proper animal registration system. As a result, owners of animals subjected to cruelty remain unpunished. Based on the above, we DEMAND: — to conduct an official investigation into cases of cruelty toward donkeys; — to apply measures предусмотренные by law against those responsible; — to strengthen legal liability for animal cruelty; — to develop effective mechanisms to support volunteers and animal shelters. An animal is not property. It is a living being that requires protection by the state. Once again, the animal was saved from death thanks to a volunteer of the “Ekolog” public association, the founder of the “Dobroe Serdtse” shelter — Alisa Tikhomirova. 🐾 Currently, this shelter houses: — more than 100 homeless dogs, — around 10 donkeys who are victims of cruelty. Each of them urgently needs: — medical treatment, — medicines, — food and daily care. ❗️ The entire burden rests on volunteers alone. 🙏 Please do not remain indifferent. Even 10,000 Uzbek soums can save one life. 💳 Donation cards: 5319519615293440 — Mastercard (USD) 5319519615173063 — Mastercard (UZS) 5614682614054668 — Uzcard 8600570424575131 If you stay silent, cruelty will continue. If you help, a life will be saved. 📢 Share this message. 📢 Do not look away. 📢 Be human. #StopAnimalCruelty#DonkeysAreLivingBeings#AnimalProtection#Ekolog#DobroeSerdtse ☘️Read the latest environmental news on the @ekologuz page. Follow us and send your suggestions and wishes via @eklguz_bot Instagram | Facebook | Twitter | Sayt | Youtube

EKOLOG.UZ| ENG

@ekologuzenglish · Post #11363 · 28.01.2026 г., 15:59

🌿 Environmental Corruption Training Launched in Nukus As part of the social project “Enhancing the Knowledge and Capacity of Journalists, Bloggers, and Civil Society Representatives in Combating Environmental Corruption”, implemented by the “Ekolog” Public Association, the latest training session was held in Nukus city. This project is carried out with a grant from the Public Fund for Supporting Civil Society Institutions under the Oliy Majlis of the Republic of Uzbekistan. 📍 The training took place in the meeting hall of the CSO House in Nukus. 👩‍🏫 Trainers included Nargis Qosimova, Director of the “Ekolog” Public Association, and Feruzbek Sayfullayev, the organization’s press secretary. 🗣 During the training, participants discussed key topics, including: — “What is environmental corruption?” — “How does it develop?” — “The links between environmental problems in Uzbekistan and corruption” The sessions were interactive, giving participants practical knowledge on how to identify and report environmental corruption, as well as understanding the role of media and civil society in combating it. ☘️ Follow the latest environmental news on our page: @ekologuz. 💬 Send your suggestions and feedback via @eklguz_bot! ☘️Read the latest environmental news on the @ekologuz page. Follow us and send your suggestions and wishes via @eklguz_bot Instagram | Facebook | Twitter | Sayt | Youtube. #Ekolog#EnvironmentalCorruption #Nukus#CivilSociety#Journalists #Bloggers#Environment#GrantProject