Три способа выполнить множество задач с asyncio
Функция для примера:
async def do_it(n):
await asyncio.sleep(random.uniform(0.5, 1))
return n
1. Последовательный вызов
async def main():
for i in range(100):
result = await do_it(i)
Такой вызов имеет смысл только тогда, когда результат одной задачи требуется для вызова следующей.
Если они независимы, то это антипаттерн, так как аналогичен простому синхронному вызову по очереди.
2. Упорядоченный результат
async def main():
tasks = [do_it(i) for i in range(100)]
results = await asyncio.gather(*tasks)
Выполняет корутины конкурентно и возвращает результат в виде списка.
Полезен когда требуется получить результаты в том же порядке в котором задачи отправлены.
3. Результат по мере готовности
tasks = [asyncio.create_task(do_it(i)) for i in range(100)]
for cor in asyncio.as_completed(tasks):
result = await cor
Так же выполняет корутины конкурентно, но не гарантирует порядок. Результат возвращается по мере готовности, каждый отдельно.
Полезен когда нужно обработать любой ответ как можно скорее.
#async
#nft#RugPull#архив
Frosties. История обмана…
В 2022 году случилась первая самая громкая афера Rug pulls NFT — это проект Frosties, на котором инвесторы потеряли 1,3 миллиона долларов😮.
Идея была основана на продаже коллекции мультяшных персонажей, похожих на шарики мороженого 🍨. Создатели проекта заманивали инвесторов бесплатными раздачами, обещали ранний доступ и привилегии в игре. Вокруг Frosties разгорелся огромный ажиотаж, поскольку игра в метавселенной и механизм ставок были обещаны как часть будущей дорожной карты.
🔴Распознать аферу было сложно. У проекта был профессиональный сайт, сообщество насчитывало 40 тыс. активных пользователей.
Каждая NFT Frosties стоила в среднем 0,04 ETH и когда были проданы 8 888 «мороженных» NFT, вкладчики обнаружили, что все соцсети, каналы в Discord, сайт и команда — исчезли 😐.
Инвесторы так и не вернули деньги 😔.
@MirraChannel😎
Hackers Target Crypto Figure for Scam
Hackers compromised World Liberty co-founder Zach Vitkoff's X account to promote a fake Trump meme token. Victims were lured by claims of imminent announcements from President Trump. Despite warnings from Vitkoff, the established token BARRON (market cap over $10B) continues to rise, indicating a scam. Another similar project executed a rug pull, draining liquidity. More details here: ForkLog
#Hacking#Crypto#Trump#MemeToken#Scam#BARRON#Liquidity#RugPull#WorldLiberty
Errol Musk's Token Plans to Raise Millions
Errol Musk aims to raise $150-$200 million through the "Musk It" memecoin, leveraging his family name. Proceeds will support the newly established Musk Institute. Recently, the crypto space has faced various rug pulls linked to projects of the same name. 🪙💰Read more here
#Musk#Memecoin#Crypto#ETFs#USDC#Ethereum#DeFi#Blockchain#Investment#Finance#ElonMusk#Bitcoin#WhaleAlert#RugPull#MuskInstitute#CryptoMarket#DigitalAssets#TokenSale#Cryptocurrency#MarketTrends#VC
Argentina's Opposition Eyes Impeachment Over LIBRA
Argentina's opposition is considering impeachment for President Milei after conflicting support for the LIBRA token. This follows a controversial launch that saw rapid investment and then a significant drop in value, leading to accusations of mismanagement and deception. The situation raises questions about political influence in cryptocurrency projects.
Read more: Reuters
#Argentina#LIBRA#Crypto#Impeachment#Milei#Investment#MarketManipulation#EconomicCrisis#Blockchain#DeFi#RugPull#Politics#Cryptocurrency#TokenLaunch#InsiderTrading#Securities#AI#VC
Argentina Investigates LIBRA Token Misconduct
Argentina's President Javier Milei calls for an investigation into LIBRA token's rug pull, requesting the Anti-Corruption Office's involvement to assess potential misconduct by government members. Findings will be forwarded to the court. Opposition considers impeachment due to the incident. Links: Statement, Watch, Details.
#LIBRA#Crypto#Argentina#investigation#rugpull#president#JavierMilei#impeachment#KIPProtocol#AntiCorruption#fundflow#temporalanalysis#MELANIA#ENRON#Solana#ETF#Bitcoin#adoption#blockchain#corruption#misconduct