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

Резултати

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

Пребарај: #leveragedposition

当前筛选 #leveragedposition清除筛选
Crypto M - Crypto News

@CryptoM · Post #64988 · 10.04.2026 г., 12:58

🚀 Hyperliquid Platform Whale Holdings Reach $3.721 Billion, Data Shows Hyperliquid platform whales currently hold positions valued at $3.721 billion, according to ChainCatcher. Data from Coinglass reveals that long positions account for $1.902 billion, representing 51.13% of the total holdings, while short positions amount to $1.818 billion, making up 48.87%. The long positions have incurred a loss of $6.8165 million, whereas the short positions have gained $17.7438 million. Notably, a whale address identified as 0xa5b0..41 has engaged in a 15x leveraged long position on ETH at a price of $2,148.7, currently showing an unrealized profit of $2.6246 million. #Hyperliquid#WhaleHoldings#ChainCatcher#Coinglass#LongPositions#ShortPositions#ETH#LeveragedPosition#Crypto#UnrealizedProfit

Crypto M - Crypto News

@CryptoM · Post #65374 · 13.04.2026 г., 03:00

🚀 Hyperithm's Oil Short Positions Experience Rapid Losses Analyst @ai_9684xtpa posted on X that Hyperithm's oil short positions have seen significant changes in just one day. Initially, these positions had a floating profit of $5.886 million, but they have now turned into a floating loss of $2.1 million. The CL short position, valued at $37.88 million, was opened at a price of $95.211 and currently has a floating loss of $1.402 million. Meanwhile, the BRENTOIL short position, valued at $35.17 million, was opened at a price of $95.986 and is experiencing a floating loss of $620 thousand. Currently, the address holds the largest leveraged position in Hyperliquid BRENTOIL and the third-largest leveraged position in CL. #Hyperithm#oil#shortpositions#floatingloss#CL#BRENTOIL#leveragedposition#Hyperliquid#analyst

Crypto M - Crypto News

@CryptoM · Post #65184 · 11.04.2026 г., 16:56

🚀 Hyperliquid Whale Positions Reach $3.905 Billion Hyperliquid platform's whale positions have reached a total of $3.905 billion, according to ChainCatcher. Data from Coinglass reveals that long positions account for $1.992 billion, representing 51.01% of the total, while short positions amount to $1.913 billion, making up 48.99%. The profit and loss for long positions stands at $29.0862 million, whereas short positions show a loss of $13.7305 million. Notably, a whale address, 0xa5b0..41, has engaged in a 15x leveraged long position on ETH at a price of $2,148.7, currently showing an unrealized profit of $6.6987 million. #Hyperliquid#WhalePositions#Billion#ChainCatcher#Coinglass#LongPositions#ShortPositions#ETH#LeveragedPosition#ProfitLoss