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

Резултати

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

Пребарај: #gst

当前筛选 #gst清除筛选
gov.sg

@Govsg · Post #1890 · 31.12.2023 г., 06:13

With the #GST rate change on 1 Jan 2024, here are some scenarios you may find yourself in. 👉🏻 Swipe to find out how the rate change affects your ongoing or upcoming transactions. 📷: @irassg More info here: go.gov.sg/GSTratechange2024

Hashtags

겁나빠른 경제 전문 - 뉴스 드리고

@dreago_news_ch · Post #262916 · 13.05.2026 г., 08:12

🔔 GST 주가, 5월 13일 66,500원 4.40% 상승 마감 📈#GST 📝#코스닥#증권 주요 주가 상승이 확인되었으나, PER이 업종 평균보다 낮아 추가 상승 여력이 다소 제한적일 수 있습니다. ⬜⬜⬜⬜⬜│🟥⬜⬜⬜⬜ 【 겁나빠른 #드리고봇 뉴스 】 https://www.topstarnews.net/news/articleView.html?idxno=16059597

IRAS

@irassg · Post #725 · 22.12.2023 г., 06:30

Navigate the right GST rate to pay for transactions spanning the rate change with new mummy and her bestie! 💁‍♀️💡 A transaction is considered to span the GST rate change if one or two of the following events takes place wholly or partially on/after 1 Jan 2024: - The issuance of invoice by supplier - The receipt of payment by supplier - The delivery of goods or performance of services More info at go.gov.sg/irasgst-rc-consumers #GST#GSTRateChange#skit#iras#irassg

IRAS

@irassg · Post #723 · 20.12.2023 г., 09:10

🎵 We carry through, do what we need to do~ Yes, I’m a GST-registered business just like you 🎵 Here are 3 key things GST-registered businesses need to prepare for the 2024 GST rate change: 1) Update systems to incorporate 9% GST from 1 Jan 2024 2) Prepare price displays to reflect 9% GST from 1 Jan 2024 3) Understand transitional rules to apply the correct GST rate for transactions spanning 1 Jan 2024 Learn more at go.gov.sg/irasgst-rc-businesses #GST#GSTRateChange#iamjustlikeyou#iras#irassg