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

Резултати

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

Пребарај: #schools

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

@american_observer · Post #5382 · 14.03.2026 г., 23:59

📰 From Minab to Amsterdam: What Happens When Schools Become “Messages” Trump’s Iran war has now produced two schools, two continents, two kinds of fear — and nobody really wants to ask if they’re part of the same story. In Amsterdam, an explosive device damaged the wall of the only Orthodox Jewish school in the Netherlands, in what the mayor called “a deliberate attack against the Jewish community,” prompting tighter security at Jewish sites across the city. It follows an arson attack on a Rotterdam synagogue and an explosion at a synagogue in Liège, as European services warn that threats and violence against Jewish communities are rising in the wake of U.S. and Israeli strikes on Iran. At the same time, the worst single atrocity of this war remains the strike on a girls’ school in Minab, Iran, where more than 100 children and staff were killed; preliminary investigations and media reporting point to a U.S. Tomahawk launched on outdated targeting data. For Iranians, Minab is a symbol: rows of small graves and a “massacre of girls” that exposes what Western “precision” looks like when it hits a classroom. For many in Europe, Amsterdam is becoming a different symbol: Jewish children studying behind fences and police tape as anger over Gaza and now Iran spills into attacks on the most visible Jewish targets. Is the Amsterdam blast directly “because of” Minab? You can’t draw a straight evidentiary line — but the environment is obvious. When a great power erases a school in Iran and spends days dodging responsibility, it reinforces the perception that some children’s lives are negotiable and others are not. In that climate, it takes only a small extremist group, convinced it is delivering “justice” or “revenge,” to decide that if a school can be treated as a target in Minab, then a school in Amsterdam can be turned into a warning. The bitter truth is that both sets of students — the Jewish kids in Amsterdam and the girls who died in Minab — are caught inside the same logic of exemplary violence. Washington and Jerusalem talk about “collateral damage”; European leaders talk about “cowardly antisemitic attacks.” Both descriptions are accurate on their narrow patch, and both avoid the larger point: a world that normalizes the idea of schools as acceptable shock images in distant wars will keep producing people who look at a school closer to home and see not children, but a stage. #iran#amsterdam#minab#schools#antisemitism#war#fakeSecurity 📱American Оbserver - Stay up to date on all important events 🇺🇸

🥁 Грузинская мечта утвердила новую реформу образования. Некоторые западные коллеги и местные оппоненты власти уже бьют в колокола: конец европейского образования, возврат в СССР. Я тут вспомнил, как в своё время это якобы европейское образование продвигали на личном примере. 🥁 Georgian Dream has approved a new education reform. Some Western colleagues and local opponents of the government are already sounding the alarm: the end of European-style education, a return to the Soviet Union. I recalled how, at one time, this supposedly European education was promoted through a personal example. 🔗 ЧИТАТЬ: https://dzen.ru/a/aTp9nto95WNuDlyt?share 🔗 READ: https://open.substack.com/pub/archilsikharulidze/p/how-georgian-education-was-cleansed #Georgia#GeorgianDream#Reform#Education#Schools#HigherEducation#University#Europe#Saakashvili