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

Резултати

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

Пребарај: #prizepool

当前筛选 #prizepool清除筛选

💵23,500 in prize pools from Bidask, TeFi Alliance, Aura, and Inflake Still time to jump in — here’s what’s active right now: 🪙Torch Finance × TeFi Alliance Prize pool: $20,000 Complete simple on-chain tasks; just under a month left. Details in our post 💲Bidask Stable Pool (tgUSD / USDT) Extra pool: $2,000 Swap or add liquidity — current APY ≈ 15 %. 🏆Joint contest: AURA × Inflake × Bidask $1,500 prize pool $50 bonus in Token Rain for users who join via our link — —awarded according to the leaderboard of collected coins. Results in about a week Prizes for the top three: 🥇 — 5 games 🥈 — 3 games 🥉 — 2 games 🤔How Aura works ➡️ Each user gets free “games”; every game earns about $1.5 in tokens you can withdraw immediately. ➡️ After a quick tutorial you unlock three more games. To cash out, you’ll need an NFT pass, which adds extra games and an expected return of roughly 10%. Bidask app | Aura bot #Web3#CryptoNews#PrizePool

Crypto M - Crypto News

@CryptoM · Post #64590 · 09.04.2026 г., 09:31

🚀 Binance to Launch Treehouse (TREE) Trading Tournament with 3.5 Million TREE Prize Pool According to the announcement from Binance, the platform is set to host a Treehouse (TREE) Trading Tournament, offering eligible participants a chance to share a prize pool of 3,500,000 TREE in token vouchers. The promotion period is scheduled from 2026-04-09 10:00 (UTC) to 2026-04-19 10:00 (UTC). Eligibility for participation extends to all verified new, regular users, and Binance VIP users, while liquidity providers in the Binance Spot Liquidity Provider Program and Binance Brokers are excluded. Eligible trading pairs for the tournament include TREE/USDT and TREE/USDC. Participants must trade a cumulative amount of at least 500 USD equivalent in these pairs on Binance Spot during the promotion period to qualify for rewards. The reward structure is based on rankings determined by cumulative trading volume, with the top five participants receiving substantial TREE token vouchers. Specifically, the first-place winner will receive 175,000 TREE, while subsequent places will receive decreasing amounts down to the fifth place, which will earn 35,000 TREE. Participants ranked sixth to twentieth will share 315,000 TREE equally, and those ranked twenty-first to fiftieth will split 280,000 TREE. Further, participants ranked fifty-first to two hundredth will share 490,000 TREE, and those ranked two hundred first to one thousandth will also split 490,000 TREE. Remaining eligible participants will share 1,400,000 TREE, capped at 300 TREE per user. Token vouchers will be distributed by 2026-05-03 and must be redeemed within 21 days. The leaderboard, updated daily, will display only users who meet the minimum trading volume threshold. Binance reserves the right to disqualify participants for dishonest behavior and may amend terms without prior notice. The tournament's commencement is contingent upon the successful listing of the TREE token on Binance Spot. #Binance#Treehouse#TREE#TradingTournament#PrizePool#TokenVouchers#LiquidityProviders#SpotTrading#USDT#USDC#VIPUsers#BinanceVIP#CumulativeTradingVolume#Leaderboard#CryptoPromotion#TradingRewards#TREEtoken