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

Резултати

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

Пребарај: #greece

当前筛选 #greece清除筛选
International Geographic

@internationalgeographic · Post #5892 · 20.08.2025 г., 15:18

Folegandros Island, #Greece🇬🇷 This tiny paradise offers secluded turquoise bays, delicious seafood, and a beautiful view from the Panagia church on top of the hill.

Hashtags

International Geographic

@internationalgeographic · Post #5776 · 25.06.2025 г., 08:57

Corfu, #Greece🇬🇷 Corfu (also known as Kerkyra) is the northernmost and second-largest of the Greek Ionian Islands. The Greeks themselves use the name Kerkyra. Corfu is a very green and picturesque island. Many tourists find the atmosphere of Corfu to be more Italian than Greek, and there is a reason for this: for 400 years, this landmass in the Ionian Sea belonged to Venice. Here, you will find turquoise bays, luxurious beaches, diverse architecture, and ancient temples.

Hashtags

International Geographic

@internationalgeographic · Post #5701 · 21.05.2025 г., 12:54

Megara, #Greece Wow, that's great, it's an interesting attraction. A railway bike is a unique and exciting way to explore the stunning landscapes of Greece.

Hashtags

International Geographic

@internationalgeographic · Post #5675 · 14.05.2025 г., 14:05

Symi Island, #Greece There is no airport here, so you will be met by boat in a neoclassical harbor with pastel-colored buildings. The island of Simi is famous for the extraction of sea sponges.

Hashtags

Militant Wire

@militantwire · Post #2311 · 19.07.2022 г., 00:00

Militant Wire’s Tom Lord: I just wrote a piece on the killing of Thanos Axarlian, 30 years ago, during a 17N assassination attempt on the finance minister of #Greece. "Remembering 17N's Assassination Attempt on Finance Minister Ioannis Palaiokrassas, July 1992" by @PotempkinBrain https://twitter.com/potempkinbrain/status/1548821545174257664?s=21&t=lWm80Fg8DDtUzXgLKt-nZw

Hashtags

Militant Wire

@militantwire · Post #2166 · 14.06.2022 г., 01:20

🇬🇷🏴#Greece: Anarchist and alleged member of the Conspiracy Cells of Fire, Yannis Michailidis (aka "The Syntagma Archer"), has been taken to hospital on the 21st day of his hunger strike in prison. He has apparently lost more than 10% of his intial body weight: https://twitter.com/potempkinbrain/status/1536475186282872833?s=21&t=Tdg9UGvGARRa9FjQOyGpPA

Hashtags

Voyage.Travel.Tourism

@VOYAGE · Post #1660 · 31.01.2026 г., 13:14

Greece🇬🇷 Astypalea Island, a gem of the Dodecanese, lies in the southeastern Aegean. Its remote location has preserved authentic culture and traditions. On a central hill sits Chora, the historic capital, offering panoramic views of the endless Aegean Sea, crowned by the Venetian-era Querini Castle. 🏰🌊 #Greece | @voyage

Hashtags

Voyage.Travel.Tourism

@VOYAGE · Post #1625 · 13.12.2025 г., 13:14

Greece🇬🇷 Astypalea Island, a gem of the Dodecanese, lies in the southeastern Aegean. Its remote location has preserved authentic culture and traditions. On a central hill sits Chora, the historic capital, offering panoramic views of the endless Aegean Sea, crowned by the Venetian-era Querini Castle. 🏰🌊 #Greece | @voyage

Hashtags

Voyage.Travel.Tourism

@VOYAGE · Post #1077 · 30.08.2024 г., 12:14

🗺Greece 🇬🇷 Corfu Island has long been celebrated as one of the most charming spots in Greece. It captivates with its beauty from the very first glance. Looking at the island from an airplane window, you'll be amazed by its extraordinary emerald color. #Greece @voyage

Hashtags

123•••10•••1617
ПретходнаСтраница 1 од 17Следна