#asyncawait — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #asyncawait, aggregated by home.social.
-
CW: a rant with expletives about JavaScript
So the caller must await too. Ah no, rather return-immediately-with-a-fucking-promise. And so the caller's caller too and so on.
Now you hardly have a function call not preceded by await. Ask yourself: why is that not the default? For the other case, lets invent the keyword **getlost** to get the functionality we now have if we forget await.
😡 Sorry for venting. It is a relief.
-
CW: a rant with expletives about JavaScript
Because that's what it actually is. It does not wait at all. Quite contrary, it returns immediately, throwing the rest of the function code into a pool of stuff to be executed some day.
And the caller? Getting control back before things are really done? Without extra tooling the dev easily misses that the called async did exactly nothing and lets proceed the code as if. Fail!
-
CW: a rant with expletives about JavaScript
TypeScript is fun, but often I hate the JavaScript async/await crap.
Background: https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/
Async is like mold spreading through the code base. On top of it: why is it called **await** and not **return-immediately-with-a-fucking-promise**? ...
1/n
-
Как старый роутер съел 2.5 ГБ ОЗУ в моей вкладке, или cетевой инфаркт асинхронного кода
Интро Это история о том, как «кривой» роутер научил меня смотреть на память браузера иначе. Есть вкладка с ИИ-чатом, есть WebSocket/Streaming, есть обычный i5. И есть момент, когда все это превращается в кирпич: вкладка раздувается до гигабайтов, процессор залипает, страница оживает только на пару минут после перезагрузки. Лид Проблема оказалась не в нейросетях и не в JS. Виновник — старый домашний роутер, который не вывозил IPv6 и фрагментацию. Итог — застрявшие пакеты, нарастающий буфер в браузере и тысячи незавершенных async/await -машин в памяти. TL;DR - Вкладка с WebSocket раздувается из-за сетевых затыков. - Роутер ломает MTU/IPv6, пакеты зависают, bufferedAmount растет. - Асинхронные цепочки не завершаются и копятся в Heap. - Фикс: MTU 1400 + отключение IPv6. - В коде: мониторинг bufferedAmount , таймауты и AbortController . Симптом - Вкладка с ИИ-чатом пухнет до 1–2.5 ГБ. - CPU уходит в 100%, интерфейс замирает. - Перезагрузка помогает на 5 минут, дальше все повторяется.
https://habr.com/ru/articles/988398/
#websocket #javascript #network #performance #asyncawait #memory
-
🛠️🎉 #Zig finally got its Async/Await back! 🙄 The world's most anticipated feature for a #language no one's heard of—because, obviously, we don't have enough async/await in other languages. 😂 But hey, #compiling from the master branch makes you a real programmer, right? 🤓✨
https://charlesfonseca.substack.com/p/asyncawait-is-finally-back-in-zig #AsyncAwait #Programming #DeveloperHumor #HackerNews #ngated -
🛠️🎉 #Zig finally got its Async/Await back! 🙄 The world's most anticipated feature for a #language no one's heard of—because, obviously, we don't have enough async/await in other languages. 😂 But hey, #compiling from the master branch makes you a real programmer, right? 🤓✨
https://charlesfonseca.substack.com/p/asyncawait-is-finally-back-in-zig #AsyncAwait #Programming #DeveloperHumor #HackerNews #ngated -
#TIL about #ResonateHQ;
No, not the moribund music streaming co-op, the developers describe their project as;
"An open-source implementation of Distributed Async Await."
An open protocol described in a diagram here;
https://www.resonatehq.io/distributed-async-await
... which extends the pre-existing Async Await.
(Yes, I learned about all of this for the first time today and I'm still not entirely sure what it is).
-
timers.promises в Node.js
Привет, Хабр! Сегодня мы рассмотрим один из тех маленьких, но мощных апгрейдов Node.js, который вы, скорее всего, недооценивали. Речь о timers.promises — свежем и способе работать с setTimeout и setImmediate в асинхронных функциях.
https://habr.com/ru/companies/otus/articles/928660/
#nodejs #программирование #timerspromises #setTimeout #setImmediate #AbortSignal #asyncawait #таймеры_в_Nodejs
-
🚀 Mastering API Handling in React & Vanilla JS – One Step at a Time!
This week, I deep-dived into handling APIs in React and Vanilla JavaScript – not just fetching data, but doing it efficiently and securely which includes: Fetch, CRUD, Query Params, Auth, and AbortController Explained
#ReactJS #JavaScript #WebDevelopment #Frontend #APIs #AbortController #Authentication #Authorization #AsyncAwait #LinkedInLearning #100DaysOfCode
https://dev.to/shubhamtiwari909/handling-apis-in-frontend-a-complete-guide-fmo
-
Async to run background function or task in C# Tip #40 Using async and Task in C# to run a background function while the main method continues executing a counter until the background task completes. #CSharp #AsyncAwait #Multithreading #Task #DotNet #BackgroundProcessing
-
Async and Await Non-Blocking UI in C# Tip #39 Using async and await in C# keeps the UI responsive during long tasks like delays. Without them, the UI freezes and becomes unresponsive until the task is complete. #CSharp #AsyncAwait #ResponsiveUI #ProgrammingTips #DotNet #vscode
-
Почему джуны путаются в асинхронном коде (и как научиться с ним работать)
Асинхронный код часто становится камнем преткновения для начинающих разработчиков. Почему функции выполняются не в том порядке, зачем нужны промисы, и что делает async/await? В статье я простыми словами объясняю: - Как работает Event Loop и почему это важно. - Какие ошибки чаще всего допускают джуны при работе с асинхронностью. - Как научиться писать понятный и предсказуемый асинхронный код. Если асинхронность вызывает больше вопросов, чем ответов, загляните в статью - там всё по шагам. 🙂
https://habr.com/ru/articles/871328/
#Асинхронность #javascript #event_loop #промисы #callbacks #вебразработка #отладка_кода #обучение_программированию #asyncawait
-
Почему джуны путаются в асинхронном коде (и как научиться с ним работать)
Асинхронный код часто становится камнем преткновения для начинающих разработчиков. Почему функции выполняются не в том порядке, зачем нужны промисы, и что делает async/await? В статье я простыми словами объясняю: - Как работает Event Loop и почему это важно. - Какие ошибки чаще всего допускают джуны при работе с асинхронностью. - Как научиться писать понятный и предсказуемый асинхронный код. Если асинхронность вызывает больше вопросов, чем ответов, загляните в статью - там всё по шагам. 🙂
https://habr.com/ru/articles/871328/
#Асинхронность #javascript #event_loop #промисы #callbacks #вебразработка #отладка_кода #обучение_программированию #asyncawait
-
Почему джуны путаются в асинхронном коде (и как научиться с ним работать)
Асинхронный код часто становится камнем преткновения для начинающих разработчиков. Почему функции выполняются не в том порядке, зачем нужны промисы, и что делает async/await? В статье я простыми словами объясняю: - Как работает Event Loop и почему это важно. - Какие ошибки чаще всего допускают джуны при работе с асинхронностью. - Как научиться писать понятный и предсказуемый асинхронный код. Если асинхронность вызывает больше вопросов, чем ответов, загляните в статью - там всё по шагам. 🙂
https://habr.com/ru/articles/871328/
#Асинхронность #javascript #event_loop #промисы #callbacks #вебразработка #отладка_кода #обучение_программированию #asyncawait
-
Почему джуны путаются в асинхронном коде (и как научиться с ним работать)
Асинхронный код часто становится камнем преткновения для начинающих разработчиков. Почему функции выполняются не в том порядке, зачем нужны промисы, и что делает async/await? В статье я простыми словами объясняю: - Как работает Event Loop и почему это важно. - Какие ошибки чаще всего допускают джуны при работе с асинхронностью. - Как научиться писать понятный и предсказуемый асинхронный код. Если асинхронность вызывает больше вопросов, чем ответов, загляните в статью - там всё по шагам. 🙂
https://habr.com/ru/articles/871328/
#Асинхронность #javascript #event_loop #промисы #callbacks #вебразработка #отладка_кода #обучение_программированию #asyncawait
-
🚀 New blog post alert! Dive into the world of concurrency in Rust with our latest article: Navigating Concurrency in Rust: The Complex Dance of Async/Await and Threads 💻
https://www.eliza-ng.me/post/asyncawaitthrea/
#RustLang #Concurrency #AsyncAwait #Threads -
Unit testing async/await logic can be done by marking your unit test as asynchronous and using a new XCTest method.
#Swift #Programming #macOS #iOS #AsyncAwait #Concurrency
https://www.avanderlee.com/concurrency/unit-testing-async-await/ -
🔥:
“Async Rust Is A Bad Language”, Matt Kline (https://bitbashing.io/async-rust.html).
Via HN: https://news.ycombinator.com/item?id=37435515
On Lobsters: https://lobste.rs/s/cryfiu/async_rust_is_bad_language
On /r/rust: https://www.reddit.com/r/rust/comments/16dk9ya/async_rust_is_a_bad_language/
#Rust #Concurrency #Async #AsyncAwait #Threads #Parallelism #ARC #MemoryManagement #Ergonomics
-
Marco Sanna zeigt in seinem Vortrag "Von UIKit zu SwiftUI - Eine Refactoring Reise" auf der #Macoun23 am Beispiel einer aktiv genutzten Produktivapp, wie eine komplexe Änderung der Architektur ohne Einschränkungen für Benutzer und Entwicklungsteam umgesetzt werden kann.
Sei dabei: https://macoun.de/anmelden
#SwiftUI #Storyboards #RxSwift #CleanArchitecture #AsyncAwait #macounFFM
-
Marco Sanna zeigt in seinem Vortrag "Von UIKit zu SwiftUI - Eine Refactoring Reise" auf der #Macoun23 am Beispiel einer aktiv genutzten Produktivapp, wie eine komplexe Änderung der Architektur ohne Einschränkungen für Benutzer und Entwicklungsteam umgesetzt werden kann.
Sei dabei: https://macoun.de/anmelden
#SwiftUI #Storyboards #RxSwift #CleanArchitecture #AsyncAwait #macounFFM
-
Marco Sanna zeigt in seinem Vortrag "Von UIKit zu SwiftUI - Eine Refactoring Reise" auf der #Macoun23 am Beispiel einer aktiv genutzten Produktivapp, wie eine komplexe Änderung der Architektur ohne Einschränkungen für Benutzer und Entwicklungsteam umgesetzt werden kann.
Sei dabei: https://macoun.de/anmelden
#SwiftUI #Storyboards #RxSwift #CleanArchitecture #AsyncAwait #macounFFM
-
Marco Sanna zeigt in seinem Vortrag "Von UIKit zu SwiftUI - Eine Refactoring Reise" auf der #Macoun23 am Beispiel einer aktiv genutzten Produktivapp, wie eine komplexe Änderung der Architektur ohne Einschränkungen für Benutzer und Entwicklungsteam umgesetzt werden kann.
Sei dabei: https://macoun.de/anmelden
#SwiftUI #Storyboards #RxSwift #CleanArchitecture #AsyncAwait #macounFFM
-
Marco Sanna zeigt in seinem Vortrag "Von UIKit zu SwiftUI - Eine Refactoring Reise" auf der #Macoun23 am Beispiel einer aktiv genutzten Produktivapp, wie eine komplexe Änderung der Architektur ohne Einschränkungen für Benutzer und Entwicklungsteam umgesetzt werden kann.
Sei dabei: https://macoun.de/anmelden
#SwiftUI #Storyboards #RxSwift #CleanArchitecture #AsyncAwait #macounFFM
-
Can a Swift async method return multiple results over time? Different types, so I don’t think I can use AsyncSequence? Something like (pseudocode)
let (showProgress: async Bool, result: async MyThing) = await doSomethingLengthy()
if await showProgress {
showProgressScreen()
}
processResult(await result)?
doSomethingLengthy() would guarantee that doProgress is fulfilled before result, in case that helps.
Or must it be a 2-method delegate?
-
@helge hiding the tags is a bad idea. People often use tags as part of the content. E.g. “#asyncAwait is awesome in #Swift” which would show up for you as “is awesome in”.
-
Since XCTest does not support async expressions in its assert functions I released SwiftAsyncAsserts Swift package to fill that gap.
Write more readable testing code for your async type interfaces in Swift.
-
How does async in Rust work?
https://bertptrs.nl/2023/04/27/how-does-async-rust-work.html
-
Swift Concurrency 🚅
We deal with async/await code every day. We use Task. But we don't often think about Task inheritance. 🤘
- Tasks inherit the parent task’s attributed, like priority, actor.
- Cancelling a parent task automatically cancels the child task.
- Detached Tasks don't inherit anything and you're responsible for cancelling them (in child task context)And it's better to avoid detached task if it’s possible
-
The fact that there is a thing called "megaYield" to work around async/await problems in swift is just sad.
-
Just went through [Unit testing Asynchronous Code in Swift] by @tundsdev on this video:
https://www.youtube.com/watch?v=P4Zee8weKVY
Absolutely brilliant, clear and concise explanation. I would highly recommend it. 👌🏾
Got me doing a bit of refactoring on some of my unit tests too. Even more so, I discovered that Apple did release an Async/Await API for HealthKit (starting with iOS v15) and I went ahead and made a bunch of code updates there too.
-
Here's a convenient helper I wrote that can be used to simplify asynchronous initialization of heavy objects without caring about concurrency or call order: https://gist.github.com/moonshinebot/f63cc09eec1c064a6ba9979f0ae753f9
The pattern scales to multiple lazy properties, and even multiple independent initializers can be used per class (if desired).
-
Here's a convenient helper I wrote that can be used to simplify asynchronous initialization of heavy objects without caring about concurrency or call order: https://gist.github.com/moonshinebot/f63cc09eec1c064a6ba9979f0ae753f9
The pattern scales to multiple lazy properties, and even multiple independent initializers can be used per class (if desired).
-
Here's a convenient helper I wrote that can be used to simplify asynchronous initialization of heavy objects without caring about concurrency or call order: https://gist.github.com/moonshinebot/f63cc09eec1c064a6ba9979f0ae753f9
The pattern scales to multiple lazy properties, and even multiple independent initializers can be used per class (if desired).
-
A great tutorial on Async/await #asyncawait #promises #javascript #coding
https://javascript.info/async-await -
Async/await without try/catch in JavaScript #javascript #coding #asyncawait #promises
https://itnext.io/async-await-without-try-catch-in-javascript-6dcdf705f8b1