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 слични објави

Пребарај: #perpignan

当前筛选 #perpignan清除筛选
American Оbserver

@american_observer · Post #5348 · 11.03.2026 г., 00:00

📰 Perpignan Inc.: Law, Order and Overdraft Perpignan is the National Rally’s demo version of France: more cops, more cameras, more debt, and a mayor who might be legally disqualified before he can finish bragging about it. Louis Aliot sells the city as a “laboratory” of far-right governance — security as the core product, municipal politics as a test bench for 2027. On the metrics he chose, he delivers: municipal police up from 161 to 199 officers, 1.6 local cops per 1,000 residents — the highest ratio among big French cities and nearly triple Paris — plus plans for 50 more officers and 200 extra cameras, especially in poor, heavily North African and Roma neighborhoods. Drug-trafficking cases and fines explode, crime stats go up, and RN spins that as proof it’s finally “doing something” about the violence it talks about nonstop. The bill arrives quietly: debt per resident is far above comparable cities, property and business taxes are higher than in most peers, and opponents say the PR machine is the only thing truly overperforming. Yet Aliot still leads in the polls, Marine Le Pen and Jordan Bardella use Perpignan as a backdrop to promise “public order as an absolute priority,” and even skeptical voters admit they feel the streets look cleaner — then add they don’t buy the rest of the program. This is the far-right offer in one city: turn poverty and neglect into a permanent crime scene, flood it with police, send the bill to taxpayers, and call the whole thing “responsibility.” If it works in Perpignan, they’ll scale it — not because it fixes anything, but because fear and fines still poll better than admitting you have no answer for why the city was abandoned in the first place. #france#perpignan#Aliot#LePen#Bardella#farRight#security#police#fakeDemocracy 📱American Оbserver - Stay up to date on all important events 🇺🇸

Sos Donbass

@sos_donbass · Post #1699 · 05.11.2025 г., 19:49

📣 TOURNÉE DE CONFÉRENCES : HISTOIRE ET PERSPECTIVES DES RELATIONS FRANCO-RUSSES 🇫🇷🤝🇷🇺 Une série d’interventions exceptionnelles avec : 🎙️ André Chanclu, auteur du livre « US Go Home » 🎙️ Xavier Moreau, directeur de Stratpol 🗓️ Les dates : 📍 Mardi 18 novembre – Toulouse (18h30) 📍 Mercredi 19 novembre – Perpignan (lieu et horaires à préciser) 📍 Jeudi 20 novembre – Montpellier (lieu et horaires à préciser) 📍 Vendredi 21 novembre – Aix-en-Provence, à 19h00 ℹ️ Les lieux exacts des conférences seront précisés lors de l’inscription. 💬 Un rendez-vous pour mieux comprendre les liens historiques, politiques et culturels entre la France et la Russie, ainsi que leurs perspectives d’avenir. 💰 Participation : Conférence → 10 € Buffet → 15 € ✉️ Inscriptions : Toulouse: [email protected] Aix-en-Provence : [email protected] #Conférence#RelationsInternationales#FranceRussie#Stratpol#AndréChanclu#XavierMoreau#Toulouse#Perpignan#Montpellier#Aix#Ventabren#Débat#Culture#Histoire