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

Пребарај: #overcharging

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

@CryptoM · Post #65345 · 13.04.2026 г., 01:44

🚀 Ethereum Layer 2 Network Scroll Faces Overcharging Issue Ethereum Layer 2 network Scroll has reportedly overcharged users by more than $50,000 in transaction fees over approximately four days. According to ChainCatcher, this occurred after the Scroll team manually increased two rate multipliers in their gas price oracle six times within six days, each time raising them by 2 to 10 times. This adjustment cumulatively increased the L1 data cost parameter to 1,280 times its original benchmark. Approximately 139,000 transactions were affected, with the total cost originally estimated at around $280, but users were charged over $50,000. The majority of these transactions were automated by bots. L2BEAT clarified that the overcharging was not due to a sequencer issue but resulted from multiplier adjustments executed through a multi-signature wallet by the team. This incident has raised questions about whether Scroll previously subsidized users with below-cost rates to maintain activity. Data from DeFiLlama indicates that Scroll's total value locked (TVL) currently stands at $24 million, a significant decline of 96% from its peak of $585 million in October 2024. As of the time of reporting, Scroll has not publicly responded to the issue. #Ethereum#Layer2#Scroll#Overcharging#GasFees#Blockchain#DeFi#TVL#CryptoNews#TransactionFees#ETH#SCR