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

Резултати

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

Пребарај: #alpha

当前筛选 #alpha清除筛选
Pro Analysis

@proanalysistrader · Post #28355 · 24.12.2024 г., 13:46

#ALPHA/USDT analysis : #ALPHA is currently in an uptrend, forming higher highs (HHs) and higher lows (HLs). The price has retraced to a support zone, and a bounce back is anticipated, with expectations to test previous highs. TF : 1D Entry : $0.0870 Target : $0.1340 SL : $0.0674

Hashtags

Pro Analysis

@proanalysistrader · Post #27943 · 18.09.2024 г., 14:26

#ALPHA/USDT analysis : #ALPHA is presently in a downtrend, trading below the 200 EMA. The price is establishing a pattern of lower lows and lower highs. Currently, it encounters resistance near the 200 EMA, indicating a possible continuation of its bearish trend and a retest of previous lows. TF : 4h Entry : $0.0558 Target : $0.0520 SL : $0.0584

Hashtags

American Crypto©

@americancryptotrading · Post #27104 · 01.01.2025 г., 17:54

🇺🇸#ALPHA/USDT is heading towards the descendingtriangle pattern on the weekly timeframe👀 Breakout - Retest - Go🐃 American Crypto©

Hashtags

Coinlegs Cryptocurrency Signals

@coinlegs · Post #9322 · 05.11.2023 г., 13:44

Custom Signal: Combination of 👉 Double Bottom 👉 Bollinger Breakout 👉 Trend Line Breakout We expect the price goes up after double bottom but we can’t trade by using only double bottom pattern. We look for another bullish moves like bollinger or trend line breakout. What if double bottom, Trend Line Breakout and Bollinger Breakout occur for any asset and it’s price hasn’t risen yet Bingo !! #ALPHA did 15% in just 3 hours 👌 Just check the chart, let’s create custom signal

Hashtags

ПретходнаСтраница 1 од 5Следна