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

Резултати

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

Пребарај: #communitycommunication

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

@CryptoM · Post #64536 · 09.04.2026 г., 06:43

🚀 Odin Fun Addresses Security Breach with Multiple Measures Odin Fun co-founder Bob Bodily announced that several initiatives are underway to address the recent security breach. According to Foresight News, the platform is being restored to its pre-attack state, and efforts are being made to retrieve large cryptocurrency withdrawals made after the incident. The company is collaborating with law enforcement and exchanges to track and freeze the attackers' funds and is preparing for legal action. Coordination is also ongoing with other Bitcoin protocols affected by third-party smart contract vulnerabilities. The vulnerability has been identified, fixed, verified, and redeployed. A comprehensive third-party smart contract audit is in progress. Odin Fun is maintaining continuous communication with the main community to reach the best solution and is discussing with users the optimal path for platform relaunch. Previously, on April 1, Odin Fun experienced an unusual large-scale sell-off, primarily involving a few meme coins like BURRITO and CRYPTOBURG. Subsequently, multiple users reported abnormal account balances and unauthorized withdrawals of BTC and tokens. #OdinFun#SecurityBreach#Cryptocurrency#SmartContracts#LawEnforcement#Bitcoin#CryptoSecurity#ForesightNews#PlatformRestoration#LegalAction#CommunityCommunication#ThirdPartyAudit#BTC#UnauthorizedWithdrawals#MemeCoins#BURRITO#CRYPTOBURG