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

Резултати

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

Пребарај: #mobilegames

当前筛选 #mobilegames清除筛选
🦅 [ perspective ix ]

@perspectiveix · Post #2040 · 05.10.2020 г., 10:25

🎮Mobile Games in Q3 2020 First-time installs of mobile games climbed nearly 28 percent Y/Y last quarter to 14.2 billion across the #AppStore and #GooglePlay globally. The majority of installs came from Google Play, which grew 36.8% from 8.7 billion in 3Q19 to 11.9 billion. Conversely, the App Store actually saw game installs decline slightly Y/Y, decreasing 4.2% from 2.4 billion in the previous year to 2.3 billion in 3Q20. This figure reflects a decrease in mobile game installs from China’s App Store; outside of China, first-time game installs were up slightly. InnerSloth’s #AmongUs was a breakaway hit, reaching No. 1 among the top-downloaded games of 3Q20 with installs that were more than 13 times what it saw in 3Q19. Read more on SensorTower. #MobileGames 🦅@perspectiveix

ДжекМа Позвонит

@jackmawillcall · Post #86 · 10.03.2020 г., 04:06

ByteDance, the company behind TikTok, has received its first game license. In China, games have to be approved first by the Chinese State Administration of Press, Publication, Radio, Film, and Television (SAPRFT) before being released to the public. In March, 51 games including Warrior Girl Parkour have gained licenses as part of the fifth and latest batch of games of approved games by the authorities (c) KrAsia #china#tiktok#bytedance#mobilegames#chinanews

Bounty Hunters 💎

@trustedairdropsss · Post #655 · 01.03.2021 г., 06:12

Unlock unlimited fun & winning at Rummy24. Download the App Now👉https://rummy24.sng.link/Averc/fcz2/lcft . . . #Rummy24#RummyApp#PlayRummy#UnlimitedFun#PlayRummy#onlinerummy#cardsgame#mobilegames#mobilegaming#mobilegame#cardgames#onlinegame#play#skills#win

Venture Village Wall 🦄

@venturevillagewall · Post #3601 · 20.12.2024 г., 16:16

Weekend Reading for Entrepreneurs Explore this week's top news: 1️⃣ Research on mobile game success probability - Read more2️⃣ Tech trends for 2025 according to Andreessen Horowitz - Find out more3️⃣ Video on David Lieb, creator of Google Photos - Watch here4️⃣ Podcast with Vlad Tenev from Robinhood - Listen in5️⃣ David Kahn's AI predictions for 2025 - Read the article6️⃣ Interview with Rocket Lab CEO Peter Beck - Explore the interview7️⃣ Turning mistakes into success with Flamp.io - Learn how #MobileGames#TechTrends#GooglePhotos#Podcast#AI#RocketLab#StartupSuccess#Sequoia#AndreessenHorowitz#VladTenev#DavidLieb#DavidKahn#PeterBeck#Flamp#YCombinator#SpaceX#Entrepreneurship#Innovation#Research#Investment#Finance