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

Резултати

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

Пребарај: #infrared

当前筛选 #infrared清除筛选
Universe Mysteries 🪐

@cosmomyst · Post #525 · 28.11.2025 г., 12:21

🪐 In 2023, astronomers discovered a free-floating planet called WISEA J110125.95+540052.8, drifting alone about 100 light-years from Earth. Unlike planets tied to stars, rogue planets like this one travel through the galaxy in darkness, warmed only by the faint heat left over from their formation and detectable mainly in infrared light—a reminder that not all worlds need a sun to wander the cosmos. ✨ #rogueplanets⚡#infrared⚡#astronomy⚡#nasa⚡#galaxy⚡#stars⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #291 · 18.09.2025 г., 13:11

🪐 The Milky Way may be home to countless rogue planets—worlds that travel alone, not bound to any star. One such loner, called WISEA J083011.95−614123.5, was spotted using infrared telescopes as it drifts in perpetual night, offering a glimpse into what planets look like when cut off from the warmth and light of a sun. ✨ #rogueplanets⚡#infrared⚡#astronomy⚡#nasa⚡#galaxy⚡#stars⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries ​

Universe Mysteries 🪐

@cosmomyst · Post #246 · 09.09.2025 г., 13:11

🪐 Astronomers estimate there could be billions of rogue planets—planets not bound to any star—drifting through our galaxy in darkness. One example, PSO J318.5-22, floats alone about 80 light-years from Earth, glowing faintly in infrared because it holds onto leftover heat from its formation, even though it has no sun to warm it. ✨ #rogueplanets⚡#galaxy⚡#infrared⚡#nasa⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries ​

Universe Mysteries 🪐

@cosmomyst · Post #730 · 02.04.2026 г., 22:21

🪐 The rogue planet PSO J318.5-22, located about 80 light-years away in the constellation Capricornus, drifts alone through space without a star to call home. Unlike planets that orbit a sun, PSO J318.5-22 glows faintly in infrared from the warmth left over from its formation, making it a true cosmic wanderer and one of the few planetary-mass objects visible in the dark between the stars. ✨ #rogueplanets⚡#exoplanets⚡#infrared⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #591 · 30.12.2025 г., 22:21

🪐 The James Webb Space Telescope has revealed distant galaxies like MACS1149-JD1 forming stars much earlier than expected, showing that galaxy building blocks were already in place just 500 million years after the Big Bang. By capturing infrared light, Webb can see through cosmic dust and uncover the birth of some of the universe’s first stars, helping scientists understand how the cosmos evolved from darkness to a landscape filled with galaxies. ✨ #Webb⚡#galaxies⚡#infrared⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #220 · 04.09.2025 г., 13:11

🪐 The James Webb Space Telescope has revealed the most detailed images yet of the galaxy cluster SMACS 0723, showing thousands of galaxies and ancient starlight that traveled over 4.6 billion years to reach us. Webb’s infrared vision lets us peer through dust and see cosmic structures, such as warped arcs of light caused by gravitational lensing—where the cluster’s mass bends and magnifies even more distant galaxies hiding behind it. ✨ #galaxies⚡#infrared⚡#lensing⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries ​

Universe Mysteries 🪐

@cosmomyst · Post #204 · 01.09.2025 г., 03:11

🪐 The James Webb Space Telescope stunned astronomers by capturing images of the faintest, most distant galaxies ever seen—like GLASS-z13, which formed when the universe was only about 300 million years old. Webb’s infrared eyes pierce cosmic dust, making it possible to observe galaxies and stars that existed just after the Big Bang, revealing clues about how the first stars and galaxies came to life. ✨ #webb⚡#galaxies⚡#infrared⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries ​

Universe Mysteries 🪐

@cosmomyst · Post #27 · 30.07.2025 г., 02:00

🪐 Near the center of our Milky Way, a cluster of young, massive stars known as the Quintuplet Cluster exists amid clouds of dust, virtually hidden from optical telescopes. Infrared observations have revealed these colossal stars, including the enigmatic "Pistol Star," which burns with a luminosity 1.6 million times brighter than our Sun and sheds mass in powerful, mysterious outbursts. ✨ #QuintupletCluster⚡#PistolStar⚡#infrared 👉subscribe Universe Mysteries

Crypto M - Crypto News

@CryptoM · Post #64835 · 10.04.2026 г., 03:16

🚀 Infrared to Unlock 27.64 Million Tokens on April 17 Infrared (IR) is set to unlock approximately 27.64 million tokens on April 17 at 0:00 UTC+8. According to ChainCatcher, this information comes from the Web3 asset data platform RootData's token unlocking data. The unlocked tokens are valued at around $1.01 million. #Infrared#tokenunlocking#Web3#ChainCatcher#RootData#cryptocurrency#April17#digitalassets