@LiveHealthy · Post #6897 · 26.12.2024 г., 22:37
#healthy
Hashtags
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
Пребарај: #healthy
@LiveHealthy · Post #6897 · 26.12.2024 г., 22:37
#healthy
Hashtags
@ncdcgov · Post #4443 · 05.03.2025 г., 13:36
#Measles infection can lead to complications, especially in young children & those with weakened immune systems. Ensure the completion of routine immunisation for your children or wards to keep them safe and #healthy. #TakeResponsibility
@ncdcgov · Post #4154 · 09.01.2024 г., 08:32
#Measles infection can lead to complications, especially in young children & those with weakened immune systems. Ensure the completion of routine immunisation for your children or wards to keep them safe and #healthy. #TakeResponsibility
@ncdcgov · Post #4112 · 04.12.2023 г., 12:29
Unvaccinated young children are at the highest risk of #measles infection and its complications. Ensure the completion of routine immunisation for your children or wards to keep them safe and #healthy. #TakeResponsibility
@ncdcgov · Post #3677 · 05.01.2023 г., 11:58
Unvaccinated young children are at the highest risk of #measles infection and its complications. Ensure the completion of routine immunisation for your children or wards to keep them safe and #healthy. #TakeResponsibility
@ncdcgov · Post #3789 · 31.03.2023 г., 08:52
Vaccination is the best prevention measure against #CerebrospinalMeningitis. Ensure you complete the routine immunisation for your children or wards to keep them safe and #healthy. #TakeResponsibility
@ncdcgov · Post #4336 · 22.07.2024 г., 09:39
Vaccination is the best prevention measure against #CerebrospinalMeningitis. Ensure you complete Nigeria's routine immunisation schedule for your children or wards to keep them safe and #healthy. #DefeatMeningitis
@dzdigital3 · Post #18992 · 11.09.2025 г., 13:16
Détails and Price 👇 https://s.click.aliexpress.com/e/_EH5wZa6 Adjust Back Stretcher For Back Spine Lumbar Support Massage Muscle Relax Stretcher Posture Therapy Corrector Airbag Level High #neck#massager#healthy#healthylifestyle#massagetherapist
@dzdigital3 · Post #18991 · 11.09.2025 г., 13:11
Détails and Price 👇 https://s.click.aliexpress.com/e/_EHHIpge Portable Neck Massager for Neck Pain, Intelligent Portable Neck Massager with Heat Function, USB Charging Neck Relax Massager #neck#massager#healthy#healthylifestyle#massagetherapist
@yuristipravda · Post #753 · 24.03.2026 г., 07:04
Ну что, с коровами почти покончили, возьмёмся за пчёл: Лабораторно выращенные медоносные пчелы, созданные лишь для того, чтобы быть рабами и умирать рано. Генеральный директор ForgeBee Адам Гамильтон говорит, что компания использует ИИ и робототехнику для выращивания партий одноразовых пчел, которые будут отправляться пчеловодам и фермерам. Он говорит: "Их поведение будет манипулироваться с помощью комбинации химических веществ, которые по сути заставят пчел чаще собирать пыльцу". Эти "единицы", как они их называют, будут иметь срок жизни от двух до трех недель, посвященных опылению сельскохозяйственных культур. Кто-нибудь еще обеспокоен этим? А если эти измененные, лабораторно выращенные пчелы окажутся в дикой природе... что может пойти не так? Читайте: https://www.brownfieldagnews.com/news/lab-grown-honeybees-could-be-future-of-food-production/ #LabGrownHoneybees#honeybees#bees#pollinators#pollination#beekeepers#food#health#healthy#holistic#holistichealth#gmofreecanada#gmofreeusa#toxinfreeusa https://t.me/VseWeda/88080