Недавно делал быстрый прототип асинхронного приложения в котором требовалось вызывать много синхронного кода. Да, я знаю, что это не лучший дизайн, но нужно было быстрое решение на один процесс и без очередей. Поэтому я выполнял код в потоках.
Выглядело это примерно так:
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
🎧⤴
USDT Soars on TON Blockchain: Over $1 Billion Issuance, Overtaking Solana
The TON blockchain has recently achieved a significant milestone, surpassing $1 billion in USDT issuance, which now places it 4th in token circulation, overtaking Solana. This surge demonstrates the increasing demand for stablecoin on TON, driving liquidity and engagement. The Total Volume Locked (TVL) has increased by 27.7%, signaling growing investor confidence in TON's DeFi ecosystem. With these developments, the network is set to gain momentum, further pushing its native cryptocurrency's value upwards.
Verse 1:
They said Solana’s king, but TON’s in the ring,
USDT soaring, now that’s the new bling,
A billion in the game, we changing the flow,
Fourth place now, but we ready to grow.
Chorus:
TON in the zone, blockchain to the bone,
USDT climbing, we sittin' on the throne,
From Solana we rise, in this crypto prize,
TON keeps flexin’, watch the market rise.
Verse 2:
Liquidity's tight, TON's taking flight,
DeFi’s the wave, we shining so bright,
Locked and loaded, TVL on the grind,
Investors look sharp, yeah, they know the signs.
Chorus:
TON in the zone, blockchain to the bone,
USDT climbing, we sittin' on the throne,
From Solana we rise, in this crypto prize,
TON keeps flexin’, watch the market rise.
Bridge:
TVL surging, like waves in the sea,
More to come, just wait and see,
Crypto’s our lane, we riding it free,
TON and USDT, the future’s the key.
Verse 3:
TON network’s climbing, break that eight,
Bullish momentum, we raising the stakes,
Solana, step back, we taking the lead,
TON’s the future, watch us succeed.
Chorus:
TON in the zone, blockchain to the bone,
USDT climbing, we sittin' on the throne,
From Solana we rise, in this crypto prize,
TON keeps flexin’, watch the market rise.
#TONBlockchain
#USDT
#TONCryptoNewsRapStyle
🎧@toncoin_rap
bemo — это удобный и безопасный протокол liquid staking, дающий каждому держателю TON новые преимущества
Традиционный стейкинг TON предполагает блокировку активов, что ограничивает их использование и снижает ликвидность. Bemo предлагает уникальное решение, позволяя пользователям делегировать свои токены валидаторам, сохраняя при этом контроль и право собственности.
Таким образом, мы упрощаем процесс размещения токенов TON предлагая взамен удобную инфраструктуру и токены stTON, которые позволяют пользователям стать активными участниками системы децентрализованных финансов (DeFi), продолжая получать вознаграждение за стейкинг.
Экосистема DeFi, преимущества стейкинга и инновационный подход bemo, предлагают держателям токенов TON, стремящихся максимизировать их потенциал, оптимальное и универсальное решение.
#liquid_staking#DeFi#TONBlockchain
🎧⤴
TON Blockchain Breaks Speed Records, Hits 1 Billion Transactions: The Future of Web3?
1. TON Blockchain surpasses 1 billion transactions, half of which occurred in the last three months, showcasing its rapid growth.
2. The platform achieves a record-breaking 104,715 transactions per second (TPS), making it the fastest blockchain globally.
3. Integration with Telegram's vast user base and new partnerships, including Tether's USDT, further enhances TON's appeal.
4. TON's market position is solidified with a $17.98 billion market cap, making it a major player in the crypto world.
Verse 1:
Fastest in the game, TON's the name,
One billion strong, redefining fame,
TPS so high, it’s breakin’ the chain,
From Telegram to USDT, we reign.
Chorus:
Speed of light, yeah, we're breakin' records,
Blockchain kings, we’re the new protectors,
From one billion, we’re just gettin' started,
TON’s the future, can’t be outsmarted.
Verse 2:
Ridin’ high, $17 billion cap,
Partners lined up, ready to adapt,
From Solana to ETH, we set the pace,
TON’s here to win, it's not just a race.
Chorus:
Speed of light, yeah, we're breakin' records,
Blockchain kings, we’re the new protectors,
From one billion, we’re just gettin' started,
TON’s the future, can’t be outsmarted.
Verse 3:
Telegram’s boost, 900 mil’ strong,
Crypto’s new wave, singin’ our song,
Integration deep, the ecosystem’s grown,
TON’s the king, sittin' on the throne.
Chorus:
Speed of light, yeah, we're breakin' records,
Blockchain kings, we’re the new protectors,
From one billion, we’re just gettin' started,
TON’s the future, can’t be outsmarted.
Bridge:
From the depths of code, we rise and shine,
TON’s the future, it’s our time to climb,
Tech so smooth, it's blowin' minds,
We’re the speed demons, leave the rest behind.
#TONBlockchain
#CryptoRevolution
#Web3
🎧@toncoin_rap
🎧⤴
TON Blockchain Surges to the Top: Is This the Next Crypto Revolution?
The TON Blockchain has taken the crypto world by storm, becoming a leader in terms of annual transaction growth. As one of the fastest-growing blockchains, TON boasts an impressive ecosystem, driven largely by its close association with Telegram and a growing number of users across CIS and Asia. With its remarkable performance, the network outpaces major players like Bitcoin, offering unprecedented potential for Web3 adoption. The future of decentralized applications (DApps) and the crypto economy is being reshaped—TON’s rise to the top is just the beginning!
Chorus:
We're TON, blockchain risin', makin' moves you can't deny,
Fastest on the block, watch it grow and touch the sky.
Transactions flowin' like a stream, unstoppable and wide,
Web3’s future’s here, we’re the ones to take the ride.
Verse 1:
Came from Telegram, we ain't here to play,
Transactions through the roof, growin’ every day.
From the CIS to Asia, crypto on display,
The TON revolution’s here, no time for delay.
EVM in sight, layer-2 it’s tight,
Developers ridin’ with us, keepin’ it light.
Bitcoin we outpace, future lookin' bright,
Decentralized dreams, man, we takin' flight.
Chorus:
We're TON, blockchain risin', makin' moves you can't deny,
Fastest on the block, watch it grow and touch the sky.
Transactions flowin' like a stream, unstoppable and wide,
Web3’s future’s here, we’re the ones to take the ride.
Verse 2:
Open League in the scene, crypto on the rise,
With a cabin full of plans, takin' over the skies.
Affordable tech, unlockin' minds worldwide,
From DeFi to GameFi, come and join the tide.
Bridges to Bitcoin, yeah, we breakin’ the mold,
Ether’s on notice, TON’s gettin' bold.
No airdrop games, just stories untold,
It’s the mass adoption wave, come get involved.
Chorus:
We're TON, blockchain risin', makin' moves you can't deny,
Fastest on the block, watch it grow and touch the sky.
Transactions flowin' like a stream, unstoppable and wide,
Web3’s future’s here, we’re the ones to take the ride.
Verse 3:
From the shadows we crept, now we're front page,
Pushin’ out the limits, we the crypto age.
Layer 1 shakin’, disruptin' the stage,
Decentralized freedom, come release the cage.
Partners in place, with Tether on board,
Fintech’s future, where Toncoin’s adored.
Validator nodes climbin', pushin' the horde,
TON leads the charge, watch us soar like a sword.
Chorus:
We're TON, blockchain risin', makin' moves you can't deny,
Fastest on the block, watch it grow and touch the sky.
Transactions flowin' like a stream, unstoppable and wide,
Web3’s future’s here, we’re the ones to take the ride.
Bridge:
Exponential growth, we keep pushin’ the limit,
Cryptocurrency dreams, TON’s right in it.
Block by block, code never timid,
World’s watchin' now, TON’s the one to win it.
#TONBlockchain
#CryptoGrowth
#TONCryptoNewsRapStyle
🎧@toncoin_rap
bemo
bemo — это первый протокол ликвидного стейкинга, разработанный на блокчейне TON.
Традиционный стейкинг TON требует блокировки токенов, что ограничивает их использование. bemo оптимизирует этот процесс.
Делегируя свои активы на платформе bemo, вы получаете взамен токены stTON, которые дают возможность пользоваться DeFi экосистемой, сохраняя при этом первоначальное вознаграждение за стекинг.
#LiquidStaking#DeFi#TONBlockchain#bemo_finance
Привет!
На связи команда проекта bemo, протокола liquid staking на TON blockchain.
Мы создаем инвестиционные сервисы, доступные всем, и стремимся изменить мир децентрализованных финансов, доказав, что управление активами может быть простым и понятным.
Присоединяйтесь, следите за новостями и добро пожаловать в будущее! 🚀
#LiquidStaking#DeFi#TONBlockchain#bemo_finance
Less than 24 hours left until you can start minting your Spinners into NFTs on the TON! 🎉
👮♂ Here’s what you need to know:
• Eligibility: Mint your Spinner starting at Level 12, anytime between Levels 12 to 20.
• Commission: 0.07 TON, covering blockchain fees and infrastructure costs.
🔁 How to Mint?
Head to the NFT Overview section on your Spinner screen, press the “Convert to NFT” button, and confirm the payment.
Remember, minting is optional. Your Spinner remains free, and you can keep earning SPN without turning it into an NFT. However, if you choose to mint, your Spinner will become a full NFT within 24 hours.
Stay tuned and get ready to mint! 🌟
#SpinnerCoin#NFT#TONBlockchain#Build
🎧⤴
🤑TON Ecosystem on Fire! Major Updates from Fintopio, TBook, and XDAO You Can’t Miss
This week, the TON blockchain ecosystemrolled out exciting updates across three projects: Fintopio, TBook, and XDAO. Fintopio, one of the fastest-growing DeFi wallets on Telegram, now has 6 million active monthly users, offering fee-free transfers and NFT storage. TBook introduces free TON WISE Credit Scores, encouraging users to showcase their onchain and offchain activities for potential rewards. Lastly, XDAO is pioneering the first DAO ecosystem on TON, integrating Telegram mini-apps and introducing community-driven farming games to attract new users. TON’s rapid growth continues, with a thriving Web3 community ready to reshape digital finance.
Chorus:
We on TON, leveling up the game,
Fintopio's flexin’, ain’t nothin' the same.
TBook’s credit stack, XDAO’s on the rise,
Decentralized future, right before your eyes.
Verse 1:
From Telegram straight to the blockchain scene,
Fintopio’s the wallet that’s keepin' it clean.
Millions logged in, sending cash for free,
DeFi on your phone, simple as can be.
$HOLD points stackin’, rewards gettin’ high,
Move fast, earn big, touch the sky.
Security tight, but the game’s still smooth,
Digital assets now got nothin' to lose.
Chorus:
We on TON, leveling up the game,
Fintopio's flexin’, ain’t nothin' the same.
TBook’s credit stack, XDAO’s on the rise,
Decentralized future, right before your eyes.
Verse 2:
TBook’s in the mix, building up your score,
Onchain data, you got rewards in store.
Credit's climbing high, opportunity knocks,
Show what you’ve done, you control the stocks.
Airdrops comin’ in, WISE Credit the key,
Exclusive deals, it’s the place to be.
You a star on the rise, now the world’s in view,
Link up your past, and the rewards come through.
Chorus:
We on TON, leveling up the game,
Fintopio's flexin’, ain’t nothin' the same.
TBook’s credit stack, XDAO’s on the rise,
Decentralized future, right before your eyes.
Verse 3:
XDAO’s movin’ fast, DAOs on the map,
Farming those coins while you sit back and tap.
Mini apps in play, communities grow,
TONxDAO tech, let the future flow.
Buildin' syndicates, big moves you choose,
DAO-based biz, ain’t no time to snooze.
Empowerin’ users, decentralize it all,
New age of finance, watch the empires fall.
Chorus:
We on TON, leveling up the game,
Fintopio's flexin’, ain’t nothin' the same.
TBook’s credit stack, XDAO’s on the rise,
Decentralized future, right before your eyes.
Bridge:
No more middlemen, we takin' control,
In the TON ecosystem, we’re playin' the role.
From wallets to scores, and DAOs takin' flight,
It’s a Web3 revolution, we shine in the night.
#TONBlockchain#DeFiTakeover#Web3Revolution
#TONCryptoNewsRapStyle
🎧@toncoin_rap
💎TMONK as you know, was born to spread the word of Telegram and its founder Durov.
We said that we want to become the first #crowdfunding and #charity platform and we are working on both fronts.
And so we are really proud to present the first AMBASSADOR on the #TONBlockchain regarding the charity sector.
A person of absolute morality and great devotion to the cause.
That who has already given part of his life to helping people in the field and who knows the ton chain deeply
👀👀👀Jeribond.ton🆒🆒🆒
Our Ambassador brings with a wealth of experiences and knowledge that make him an outstanding choice to represent TMONK. We are honored to have his leadership and inspiration to guide others on our journey.
This is the first step to build the foundation of a structure that can be the #milestone in this theme for ton chain
🤝 About Jeribond.ton🤝
After working in the humanitarian sector for 8 years, Jeribond.ton has just resigned and is focusing on Web3.
Jeribond.ton worked in the neonatal and maternal health sector for this while, because over here women face a lot of pregnancy complications and also newborn babies pre or post. So JERI worked in the community by training the health workers, doctors, and nurses to best carry out their duties using best practices that work in other countries, and this helped to reduce the rate of how women die.
Jeribond.ton was instrumental as he managed the supplies and supported the work in many ways; with a small team obtained funding from an international organization to carry out these projects.
BioCM - $TON$BNX - BD lead & Advisor @Tonraffles - @Roolznft $Fish OG @binaryniglions@https://t.me/tonnigeria @https://t.me/TonNomadsChat
This is a crucial step for the advancements of our project, and we are truly proud to announce this new and exciting collaboration. We aim to build something new, something incredible that can help all the people in need around the world.
FOR THEIR #FREEDOM
Will the Federal Reserve cut rates before May 2026? 👀
Inflation says one thing. Growth says another.
Markets price probability before central banks confirm direction.
That’s where prediction systems become powerful.
#Fed#RateCuts#Macro#PredictionMarkets#EdgeMarket#TONBlockchain#Finance
Will Liverpool finish top 4 in 2025/26? 👀
Squad depth, injuries, manager adaptation, fixture pressure early predictions always reveal where confidence sits.
Yes or no ?
#Liverpool#LFC#PremierLeague#PredictionMarkets#SportsPrediction#EdgeMarket#TONBlockchain
Bidask: $RAFF & $WEB3 Listings, MyTonWallet & DeWallet Integration + Meme Contest
🏴Two new tokens are now live on Bidask:
• $RAFF — from the Ton Raffles ecosystem
• $WEB3 — from the .ton domain ecosystem
Both are now tradable in pairs against #TON. The WEB3/TON pool features boosted farming through August 5, with up to ~44% APR — rewards in $WEB3 scale based on daily trading volume:
➖ $12.5/day if volume > $10,000
➖ $25/day if volume > $15,000
➖ $37.5/day if volume > $18,000
➖ $50/day if volume > $20,000
➖ $67.5/day if volume > $23,000
➖ $75/day if volume > $25,000
🏆Bidask Meme Contest
Create a meme about Bidask Protocol, post it on X (Twitter) with the hashtag #BidaskMemeContest, and share it in the contest thread in the “meme contest thread” in the Bidask chat.
Only memes posted in both X and the chat thread will qualify.
Contest runs through August 7. Prizes include:
🥇 1st — Toy Bear #52238
🥈 2nd — Record Player #10315
🥉 3rd — Crystal Ball #3932
🏅 4th — Light Sword #7136
🏅 5th — Light Sword #72658
👛 Wallet Integrations
#MyTonWallet and DeWallet (by DFC ecosystem) have added Bidask DEX support — making it even easier to swap and farm.
📈 Top APRs on Bidask DEX right now:
• HYDRA/TON — ~1250% APR
• TON/USDT — ~87% APR
Bidask DEX |Channel
#Bidask#WEB3#RAFF#DeFi#YieldFarming#CryptoNews#CryptoTrading#TON#TONBlockchain#DEX