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

Резултати

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

Пребарај: #consciousness

当前筛选 #consciousness清除筛选
Self-Immolation

@SelfImmolation · Post #1101 · 20.01.2023 г., 02:52

“The greater and greater awakening of consciousness and its climb to a higher and higher level and a wider extent of its vision and action is the condition of our progress towards that supreme and total perfection which is the aim of our existence.” ~ Sri Aurobindo #consciousness 💖@OfLoveAndGrace💖

Interesting Planet 🌍

@interesting_planet_facts · Post #632 · 26.08.2025 г., 13:22

🌎 The phenomenon of synesthesia allows some people to experience a blending of senses—like seeing colors when hearing music or tasting flavors from words. This rare trait reveals how flexible and interconnected the human brain’s sensory pathways can be. ✨ #neuroscience⚡#consciousness⚡#perception 👉subscribe Interesting Planet ​

Interesting Planet 🌍

@interesting_planet_facts · Post #1363 · 03.04.2026 г., 12:11

🌎 Humans can perceive their own thoughts by using the brain’s “default mode network” (DMN), a group of regions active during self-reflection and daydreaming. The DMN uses up to 20% of the brain’s total energy when awake. ✨ #brain⚡#consciousness⚡#neuroscience 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #1031 · 14.11.2025 г., 12:11

🌎 Consciousness studies reveal that some patients in vegetative states still show minimal awareness. Brain scans detect distinct patterns when they are asked to imagine specific activities. These brain responses resemble those of healthy people, showing hidden layers of awareness even without outward signs. ✨ #brain⚡#consciousness⚡#neuroscience 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #997 · 02.11.2025 г., 12:11

🌎 Brains process language mostly on the left side, but imaging studies reveal that understanding jokes or irony also activates areas on the right. This pattern appears in over 90% of right-handed people. ✨ #brain⚡#neuroscience⚡#consciousness 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #925 · 17.10.2025 г., 18:11

🌎 The phenomenon of "predictive coding" means your brain constantly generates guesses about what's coming next, allowing you to react faster to new information. This system helps you interpret sights, sounds, and even social cues by comparing real signals to expectations, updating your perception in real time. Brain scans show this process is most active in the cerebral cortex. ✨ #brain⚡#neuroscience⚡#consciousness 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #856 · 04.10.2025 г., 12:11

🌎 The brain’s default mode network activates when you daydream or let your mind wander. This network is involved in self-reflection and retrieving personal memories. MRI studies show it consumes nearly as much energy as active, focused thinking. ✨ #brain⚡#consciousness⚡#neuroscience 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #793 · 21.09.2025 г., 18:11

🌎 Locked inside your skull, the human brain contains over 86 billion neurons. These nerve cells communicate through trillions of connections, forming complex circuits that create consciousness. Remarkably, all our thoughts, memories, and perceptions arise from electrical and chemical signals passing between these tiny cells. ✨ #brain⚡#neuroscience⚡#consciousness 👉subscribe Interesting Planet ​

Interesting Planet 🌍

@interesting_planet_facts · Post #758 · 16.09.2025 г., 00:22

🌎 The phenomenon called "blindsight" occurs when people with damage to their visual cortex can respond to visual stimuli without conscious awareness. Their eyes and optic nerves work, but the brain's primary visual center is injured—yet they can still guess locations or movements of objects correctly. Studies show blindsight patients perform above chance when identifying light or motion in their blind field. ✨ #brain⚡#consciousness⚡#neuroscience 👉subscribe Interesting Planet ​

Interesting Planet 🌍

@interesting_planet_facts · Post #727 · 11.09.2025 г., 03:22

🌎 When you recognize a friend’s face, your brain’s fusiform gyrus handles the task. Damage here can cause prosopagnosia, a condition where people cannot recognize faces—even those of loved ones. ✨ #brain⚡#neuroscience⚡#consciousness 👉subscribe Interesting Planet ​

12
ПретходнаСтраница 1 од 2Следна