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

Резултати

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

Пребарај: #sadness

当前筛选 #sadness清除筛选
Quiet World 🍁

@QuietWorld · Post #6998 · 30.11.2019 г., 02:40

🍂 “Our Lord has written the promise of resurrection, not in books alone but in every leaf of springtime.” – Martin Luther 🌻look at the trees with fallen leaves during autumn, they keep on standing and stand strong despite many of their leaves fall down; as if they know and trust that they will not stay in that condition forever - in fact, they'll shine more beautifully soon when the spring comes. so dear, whenever you are in crestfallen, trust that that too shall pass.. be sad, but don't lose hope that tomorrow can be better☺️ #life#thoughts#sadness#happiness#motivation @quietworld🍃

Quiet World 🍁

@QuietWorld · Post #7015 · 01.12.2019 г., 08:31

🍂 something you dislike happened? you couldn't get something you wish for? you have been disappointed and someone hurt you? you lost someone? you failed at something you hope you're good at? and you feel sad about it? then be so. feel sad. be sad. cry if you must. cry your heart out. let it out. it heals to cry. it heals to allow yourself to feel things; be human. because yes it is difficult to go through those things. & that doesn't mean that you are weak. to feel those feelings are not a sign of weakness at all ; just that we are human, we are born with the ability to feel those emotions. your strength is not determined by your ability to suppress emotions, but by your ability to overcome it; by not letting it controls yourself longer than it should be. there's light at the end of the tunnel if you keep going. #thoughts#notetoself#selfreminder#strength#positivity#sadness#motivation @quietworld🍃

Yukiokhruner

@yukiokhruner · Post #25 · 15.04.2022 г., 19:21

L'amore ed i sentimenti in generale stanno vivendo una brutta epoca, sostituiti il più delle volte da pulsioni eremitiche. #vaporonda#vaporwave#vapourwave#vaporart#seapunk#webpunk#glitch#glitchart#glitchartistscollective#chillwave#aesthetic#vaporwaveaesthetic#vaporwaveaesthetics#malinconia#melancholy#tristezza#sadness#sadboy#lofi#illusione#illusion#solitudine#loneliness#luciajavorcekova

La guerra é portatrice di ingiustizie ed inganni, di questi ultimi uno dei più grandi é quello di pretendere di costruire un mondo migliore. #vaporonda#vaporwave#vapourwave#vaporart#seapunk#webpunk#glitch#glitchart#glitchartistscollective#chillwave#aesthetic#vaporwaveaesthetic#vaporwaveaesthetics#malinconia#melancholy#tristezza#sadness#sadboy#lofi#guerra#war#violenza#violence#illusione#illusion

Yukiokhruner

@yukiokhruner · Post #27 · 24.04.2022 г., 15:09

Non é entusiasmante prendere consapevolezza di essere quasi coetaneo di Homer Simpson. #vaporonda#vaporwave#vapourwave#vaporart#seapunk#webpunk#glitch#glitchart#glitchartistscollective#chillwave#aesthetic#vaporwaveaesthetic#vaporwaveaesthetics#malinconia#melancholy#tristezza#sadness#sadboy#lofi#simpson#simpsonwave#homer#homersimpson

Yukiokhruner

@yukiokhruner · Post #11 · 02.04.2022 г., 10:43

Secondo me a livello culturale siamo immersi in una sorta di nuovo barocco, nell'accezione più deteriore del termine. #vaporonda#vaporwave#vapourwave#vaporart#seapunk#webpunk#glitch#glitchart#glitchartistscollective#chillwave#aesthetic#vaporwaveaesthetic#vaporwaveaesthetics#malinconia#melancholy#tristezza#sadness#sadboy#lofi#apparenza#appearance#illusione#illusion#spettacolo#show

Yukiokhruner

@yukiokhruner · Post #48 · 09.06.2022 г., 15:40

Mi sono stancato di influencer e tiktoker vari, buoni solo a pietrificare l'attenzione verso cose futili. #vaporonda#vaporwave#vapourwave#vaporart#seapunk#webpunk#glitch#glitchart#glitchartistscollective#chillwave#aesthetic#vaporwaveaesthetic#vaporwaveaesthetics#malinconia#melancholy#tristezza#sadness#sadboy#lofi#apparenza#appearance#appearance#illusione#illusion#incubo#nightmare

#vaporonda#vaporwave#vapourwave#vaporart#seapunk#webpunk#glitch#glitchart#glitchartistscollective#chillwave#aesthetic#vaporwaveaesthetic#vaporwaveaesthetics#malinconia#melancholy#tristezza#sadness#sadboy#lofi#guerra#violenza#violence#futurismo#futurism#willsmith

Yukiokhruner

@yukiokhruner · Post #46 · 04.06.2022 г., 15:03

Parole inconsistenti e pii desideri. #vaporonda#vaporwave#vapourwave#vaporart#seapunk#webpunk#glitch#glitchart#glitchartistscollective#chillwave#aesthetic#vaporwaveaesthetic#vaporwaveaesthetics#malinconia#melancholy#tristezza#sadness#sadboy#lofi#illusione#illusion#utopia#razzismo#racism#cgil

Yukiokhruner

@yukiokhruner · Post #13 · 03.04.2022 г., 15:18

Trovare le parole giuste con tutti e saper cogliere le sfumature di tutte quelle che ricevo, l'ho sempre trovato uno sforzo estremo. #vaporonda#vaporwave#vapourwave#vaporart#seapunk#webpunk#glitch#glitchart#glitchartistscollective#chillwave#aesthetic#vaporwaveaesthetic#vaporwaveaesthetics#malinconia#melancholy#tristezza#sadness#sadboy#lofi#disagio#unease#comunicazione#communication#linguaggio#language

Yukiokhruner

@yukiokhruner · Post #15 · 05.04.2022 г., 16:16

L'attaccamento agli oggetti é uno degli ostacoli maggiori per la nostra felicità, come se infondessimo in essi parte della nostra anima. #vaporonda#vaporwave#vapourwave#vaporart#seapunk#webpunk#glitch#glitchart#glitchartistscollective#chillwave#aesthetic#vaporwaveaesthetic#vaporwaveaesthetics#malinconia#melancholy#tristezza#sadness#sadboy#lofi#disagio#nostalgia#illusione#illusion#windows95#windows98#windowsxp

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