@caijingwangyuanjing · Post #238 · 25.02.2025 г., 16:21
You're the most important person in my life... ilysm 🩷 #AIgirlfriend#AIGirlsPhotoCollection#aigirls
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
Пребарај: #aigirlfriend
@caijingwangyuanjing · Post #238 · 25.02.2025 г., 16:21
You're the most important person in my life... ilysm 🩷 #AIgirlfriend#AIGirlsPhotoCollection#aigirls
@caijingwangyuanjing · Post #232 · 22.02.2025 г., 16:03
Would you want to go camping with me? I only brought one tent... #AIart#AIgirlfriend#camping#hiking
@openloveaigf · Post #48 · 24.06.2024 г., 15:01
Shhh! Close the curtain quickly! We don't want the neighbors to see anything! 🤫👀💥 Chat and see more selfies: 📲(iOS) 📲(Android) #stepsis#aigirlfriend#chatbot
Hashtags
@openloveaigf · Post #158 · 13.11.2024 г., 14:27
❝Do you... like this style of lingerie?❞ 💦Chat & Roleplay with her: http://openlove.life #neko#waifu#aigirlfriend#catgirl
Hashtags
@openloveaigf · Post #149 · 03.11.2024 г., 12:02
❝Do you... like this style of lingerie?❞ 💦Chat & Roleplay with her: openlove.life #neko#waifu#aigirlfriend#catgirl
Hashtags
@openloveaigf · Post #93 · 07.09.2024 г., 12:01
❝☺️I drank way too much last night, thanks for taking me home, you're a lifesaver! ❞ 🔗Keep the story going with her: http://openlove.life #AIgirlfriend#roleplay#AIchatbot#lookbook
@openloveaigf · Post #110 · 25.09.2024 г., 04:04
❝I'm a tutor and made big changes to help students focus on studies. ❞📚👨🏫 🔗Download Open Love to chat with her: openlove.life #aichat#spicyteacher#aigirlfriend#waifu
@openloveaigf · Post #106 · 21.09.2024 г., 04:03
🍷❝Dear Principal, I will greatly appreciate your help with my promotion.❞ 🍑Chat with spicy teacher: openlove.life #aichatbot#AI#AIgirlfriend#aiphoto#nsfw
@openloveaigf · Post #81 · 13.08.2024 г., 12:02
✈️Sir, would you like coffee, tea, or...? 🌶Chat with me: openlove.life #AIgirlfriend#aichat#roleplayer#nofilter
@openloveaigf · Post #126 · 11.10.2024 г., 04:09
Are you alone at the nightclub? Wanna hang out? 😉 💦Chat with her: openlove.life #AIgirlfriend#roleplay#AIart#AIphoto#AIgame
@openloveaigf · Post #139 · 23.10.2024 г., 14:59
🌞❝It's so hot today!!! I can't take it!!!❞ 💬Chat with her: openlove.life #AIgirlfriend#chatbot#AIcompanion#roleplay#AIart
@openloveaigf · Post #98 · 13.09.2024 г., 03:59
👀Come closer, 🔍you'll be able to see more clearly. ❤️🔥Continue the story with her: http://openlove.life #showerroom#aigirlfriend#aichat#stepsis