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

Резултати

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

Пребарај: #commerzbank

当前筛选 #commerzbank清除筛选
Libertà è ragione

@libertaeragione · Post #4246 · 24.09.2024 г., 11:07

#Italia#Germania#USA È scoppiato in questi giorni il caso #Unicredit: la banca ha infatti annunciato che la sua quota in #Commerzbank (importante banca tedesca) è ora al 21%, grazie all'acquisto di uno strumento finanziario che rappresenta circa l'11,5%, sommato alla partecipazione del 9,5% precedentemente acquisita in due tranche: metà sul mercato e l’altra metà nel corso di un’asta indetta dal Governo tedesco, che, a suo dire, era inconsapevole delle volontà della banca italiana. UniCredit ha chiesto alla #BCE il permesso di arrivare fino al 29,9%, mantenendosi al di sotto del limite che imporrebbe un'offerta pubblica di acquisto obbligatoria. La reazione del cancelliere tedesco Olaf #Scholz (#SPD|S&D) è stata dura: "Le acquisizioni ostili non sono una buona cosa". Anche i sindacati tedeschi si dichiarano sul piede di guerra per i tagli temuti. La risposta del Ministro degli Esteri Antonio #Tajani (#FI|EPP) è arrivata a margine dei lavori dell'Assemblea #ONU a #NYC: "In Europa c'è libero mercato, non capisco perché quando qualcuno viene ad acquistare in Italia si dice che siamo in un sistema europeo moderno del mercato unico, se poi un italiano acquista fuori non è più nel mercato unico. Sono certamente iniziative di privati queste, ma legittime, quindi non comprendo perché dovrebbe essere un atto ostile quella di un'impresa italiana che acquista nel mercato europeo. Poi ci sono le norme dell'Unione bancaria, ci sono le norme europee, quindi mi pare che Unicredit le abbia rispettate". @OsservatorioItaliano

Savino Balzano

@savinobalzano · Post #756 · 24.09.2024 г., 16:59

https://x.com/SavinoBalzano/status/1838621376539664486?t=8gFSY8t9sWXZ4AQlOQa87g&s=19 E qui casca l'asino! Il #Cancelliere tedesco #Scholz si è incazzato: #Unicredit ostile su #Commerzbank. La vicenda dimostra la reale natura di un'#UE fatta per consentire ai più forti di depredare i più deboli: il gioco è ben accetto quando è la #Germania (o la #Francia) a spolparci; no, quando è l'#Italia ad alzare la capoccia. Insomma, tutti felici e contenti se il nostro Paese fa la parte del supermarket. È per questo che è stato pensato il mercato unico ed è fisiologico che restino spaesati da questo evento assai assai raro. Avremmo dovuto imbufalirci noi, tante e tante volte e non lo abbiamo fatto: stendiamo un velo pietoso. Sia chiaro, quella di #OlafScholz è solo una pagliacciata: il vento sta cambiando, se la sta facendo sotto, e prova disperatamente a mostrare qualche muscolo. La verità è che il patriottismo non sanno nemmeno dove sta di casa: è andato a picco col sabotaggio del #Nordstream. La mia a #5Notizie, #RadioCusanoCampus.

Crypto M - Crypto News

@CryptoM · Post #64541 · 09.04.2026 г., 07:05

🚀 U.S. Dollar Index Remains Stable Amid Middle East Tensions The U.S. Dollar Index (DXY) maintained stability on April 9, despite ongoing uncertainties surrounding the conflict in Iran. According to BlockBeats, the situation remains tense following a two-week ceasefire agreement between the United States and Iran. Iran continues to launch missiles and drones towards Arab nations in the Persian Gulf, while Israel has targeted Hezbollah militants in Lebanon. Iran has also informed mediators of its intention to limit the number of ships passing through the Strait of Hormuz and impose transit fees. Analysts from Commerzbank have expressed concerns, suggesting that the ceasefire may be a fragile pause in the conflict, as it inherently implies further negotiations. #USDollarIndex#MiddleEastTensions#IranConflict#DXY#Ceasefire#StraitOfHormuz#PersianGulf#Israel#Hezbollah#Commerzbank#TransitFees#GlobalUncertainty