@bestwallpapes · Post #3332 · 01.04.2025 г., 13:36
@Bestwallpapes #Food#Yummy
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
Пребарај: #yummy
@bestwallpapes · Post #3332 · 01.04.2025 г., 13:36
@Bestwallpapes #Food#Yummy
@instavine · Post #1084 · 11.03.2017 г., 14:00
#food#yummy#hungry🍿🍬 ------------ @instavine
@TgDict · Post #212 · 08.11.2023 г., 15:44
#food#picture#yummy https://t.me/fporn https://t.me/restaurantfood https://t.me/onlyfood https://t.me/dailyfoodporn https://t.me/foodovik https://t.me/foodrumedia https://t.me/aiqing
@ThemesM8 · Post #293 · 04.05.2022 г., 17:50
https://t.me/addtheme/Cookies_ThemesM8 🍬@ThemesM8🍭 #light#android#desktop#cookie#cookies#cute#pastel#sweet#white#green#yummy#colors#colorful#theme#themes#telegram_theme
@cookingdish · Post #577 · 11.11.2024 г., 15:21
Caramelized Shallots Pumpkin Pasta 🎃🍝 Recipe for 2 servings Ingredients: - 1/2 Hokkaido pumpkin 🎃 - 250 g pasta 🍝 - 250 g shallots 🧅 - Vegan butter for frying 🧈 - 25 ml maple syrup 🍁 - 100 g vegan cream cheese 🌱 - 300 ml vegetable stock 🥕🍲 - Pinch of salt and pepper 🧂 Toppings - Parsley, chopped 🌿 Preparation: 1. Dice the pumpkin and blanch for 10 minutes 🍲 2. Cook the pasta 🍝 3. Fry the shallots in butter, add maple syrup for a caramelized touch 🍁🧅 4. Deglaze with vegetable stock, add the pumpkin, stir, and simmer briefly 🎃🍲 5. Stir in the cream cheese, then mix in the pasta 🌱🍝 6. Top with fresh parsley and enjoy! 🌿✨ #VeganPasta#PumpkinSeason#CaramelizedShallots#ComfortFood#FallRecipes#PlantBased#EasyMeals#Yummy#PastaNight @dishes
@the_intelligent_investors · Post #1194 · 14.02.2024 г., 04:23
💎hadyo com | JBEZOS029 🎉#reels#top#reelsinstagram#trends#best#fyp#trendingreels#reelsinsta#usa#newyorknewyork#repost#regrann#youtube#yoga#yummy#newyork#foryou#cryptocurrency#crypto