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

Резултати

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

Пребарај: #kirk

当前筛选 #kirk清除筛选
Trump's Ear

@trumpsear_tg · Post #1545 · 22.09.2025 г., 19:59

The vast majority of media, politicians and ordinary people after the murder of Charlie Kirk: "Hate speech led to this, we must stop spreading hatred against each other" Donald Trump:"I FUCKING HATE YOU ALL" #Trump#Kirk 👂More on Trump's Ear ⚠️

Hashtags

Trump's Ear

@trumpsear_tg · Post #1494 · 11.09.2025 г., 14:01

Donald Trump has promised to find all those involved in the murder of his colleague, conservative activist Charlie Kirk. According to the US president, the shot at Kirk is an attack on the United States and American values. #Trump#Kirk 👂More on Trump's Ear ⚠️

Hashtags

Trump's Ear

@trumpsear_tg · Post #1547 · 23.09.2025 г., 00:05

Even the liberal media in the United States admire Charlie Kirk's widow after her speech at the funeral ceremony.: She forgave her husband's murderer. Some see her as a completely new political figure among conservatives. Over the past day, the widow of conservative activist Charlie Kirk, Erica, conquered the United States with her speech at a farewell ceremony in Glendale. She went to the podium and forgave her husband's murderer: Forgiveness is the highest commandment of Christianity. Just as Jesus himself asked for mercy for his tormentors on the cross, Erica Kirk, a deeply religious woman, took the same position. These words stirred up conservative America. US President Donald Trump acted differently: instead of unity and reconciliation, he made it clear that he did not share Erica's message: This, he admitted, distinguishes him from Charlie and Erica. The American media admire Erica and are already talking about the "Donald Trump way" and the "Erica Kirk way" that American conservatives can follow. MSNBC said Erica's words were "what America needed to hear." Even the Washington Post, which is close to the Democrats, saw a new political figure in the widow. In a column titled "The Example of Erica Kirk," the publication wrote that her speech "made a tangible difference between Trump's uncompromising policies and the spirit of Christian love for one's neighbor." Thus, Charlie Kirk's murder could be a turning point — the beginning of a change for religious conservatives. And Charlie Kirk's organization, Turning Point USA, now headed by Erica, is experiencing an unprecedented boom: since the day of the tragedy, tens of thousands of young people have applied to new groups and donated millions of dollars to the organization. #Kirk#Media 👂More on Trump's Ear ⚠️

Hashtags

Trump's Ear

@trumpsear_tg · Post #1497 · 11.09.2025 г., 20:33

Time magazine dedicated the cover of its issue to Charlie Kirk, an American right-wing activist and executive director of Turning Point USA, who was killed the day before. #Kirk#Media 👂More on Trump's Ear ⚠️

Hashtags

Trump's Ear

@trumpsear_tg · Post #1559 · 24.09.2025 г., 19:59

Jimmy Kimmel returned to the air and attacked Trump American TV host Jimmy Kimmel returned to the air after the ABC television channel removed his program because of jokes about the death of conservative activist Charlie Kirk. The audience greeted him with ovations and shouts of "Jimmy, Jimmy!", and the host himself immediately lunged towards the White House. In general, Kimmel remained true to himself: he devoted the rest of the broadcast to harsh satire on Trump, including in a sketch with Robert De Niro. The US president reacted on his Truth Social network. #Trump#Media#Kirk 👂More on Trump's Ear ⚠️

Trump's Ear

@trumpsear_tg · Post #1538 · 19.09.2025 г., 18:01

American TV host Jimmy Fallon defended Jimmy Kimmel amid pressure from Trump The scandal surrounding the closure of Jimmy Kimmel's show is gaining momentum. After ABC took Jimmy Kimmel Live off the air because of jokes about the death of right-wing activist Charlie Kirk and criticism of Trump supporters, another giant of American comedy, Jimmy Fallon, came out in support of his colleague. In his program, the Tonight Show, he stated that this is not only about television, but also about protecting freedom of speech. Fallon, who humorously played up the situation in a sketch about Donald Trump's visit to the UK, stressed that satire cannot be silenced, and political criticism has always been a part of American culture. According to him, attempts to silence the presenters are a dangerous precedent. Trump himself had previously demanded that both Fallon and another popular late-night show host on American television, Seth Myers, be removed from the air. Other presenters joined the protest. Stephen Colbert supported both Jimmy's, saying that not only the show, but also the foundations of democracy are at risk. Television legend David Letterman called ABC's behavior "shameful and pathetic," and former President Barack Obama said it was "the best illustration of cancel culture" and a direct interference with freedom of expression. #Trump#Media#Kirk 👂More on Trump's Ear ⚠️

Trump's Ear

@trumpsear_tg · Post #1531 · 18.09.2025 г., 18:02

ABC Pulled Jimmy Kimmel's Show After His Jokes About Charlie Kirk's Death The American television channel ABC has suspended the release of the Jimmy Kimmel Live evening show for an "indefinite period." According to AFP, the reason was the host's jokes about the recent murder of right-wing activist and Trump supporter Charlie Kirk. The channel's decision especially pleased President Donald Trump, who has been openly feuding with Kimmel for many years. Kirk was shot dead last week during a speech at the University of Utah. The accused is 22—year-old Tyler Robinson, who has been charged with murder. "The MAGA gang desperately tried to portray the perpetrator as anything but one of them, and did everything possible to gain political advantage," Kimmel said on air. The remarks provoked a flurry of criticism: the chair of the Federal Communications Commission, Brendan Carr, threatened ABC with revocation of its license, and Nexstar media holding announced that it would temporarily not show the show. ABC President Andrew Alford called Kimmel's words offensive and inappropriate at a time when the country is in crisis. Now there are only two major evening shows left on American television — Jimmy Fallon and Seth Meyers, but Trump is already demanding that they be removed from the air. #Trump#Media#Kirk 👂More on Trump's Ear ⚠️

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