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 слични објави

Пребарај: #financetechnology

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

@CryptoM · Post #64464 · 09.04.2026 г., 01:17

🚀 CZ: Crypto vs Traditional Finance Is a False Divide — 'It's Just a New Technology for Finance' Speaking on The Wolf of All Streets Podcast, Binance founder Changpeng Zhao (CZ) revealed that he shared his memoir Freedom of Money with BlackRock CEO Larry Fink and obtained a quote from him, praising Fink as an example of someone who publicly changed his mind on Bitcoin and pushed it hard afterwards. CZ said he views the framing of crypto versus traditional finance as a false dichotomy — crypto is simply a new technology for finance, and convergence between the two is inevitable, with tokenization of real-world assets as a key driver. On access, CZ argued that any person anywhere in the world should be able to buy any listed stock, calling current restrictions an anomaly that blockchain can help resolve. CZ said the "72 principles" attributed to him online were counted by a Chinese KOL on X, not by him; he removed numbered headings intentionally. He said the principles blog began after a meeting with Ray Dalio in 2021 or 2022, during which Dalio encouraged him to write down his decision-making principles, and it is included as an appendix in Freedom of Money. #Crypto#TraditionalFinance#Blockchain#Tokenization#FinanceTechnology#GlobalFinance#Binance#CZ#LarryFink#RayDalio#BNB#BTC

Venture Village Wall 🦄

@venturevillagewall · Post #4084 · 06.02.2025 г., 16:00

Ondo Finance Launches Layer 1 Blockchain Ondo Finance has officially unveiled the Ondo Chain, a new Layer 1 blockchain designed to facilitate financial markets at an institutional level. This initiative aims to enhance the tokenization of real-world assets, leveraging Blockchain technology to streamline future financial transactions. More details available here. #OndoFinance#Blockchain#RWA#Finance#Crypto#DeFi#InstitutionalFinance#Tokenization#RealWorldAssets#Layer1#CryptoNews#USDC#Innovation#TechNews#Investment#MarketUpdates#Tokenomics#FinanceTechnology#FinancialMarkets#Community