2024-11-14 04:08:00
andrewzuo.com
I recently saw this meme about async
and await
.
It’s so good. It captures exactly how I feel about async
and await
. If you wait for async
code your function now has to be async
as well. And if there’s any function relying on that function that code also has to be async
and on and on and on. Until you reach the top level.
I’ve always hated this. But there’s no better way to do this. It’s a necessary evil. Right..? Well, I’ve recently been coding a lot in Go. And Go does not have async
and await
. And this is despite it being famous for its concurrency. And you know what? I really like it.
So the first time I realized that Go did not have async
/await
was when I wanted to get my function to wait one second. This is because I make an RSS reader Stratum (iOS, Android) that fetches a lot of RSS feeds. And it turns out sites don’t like it if you spam their site with requests. They will rate limit you. So I decided to add a one second delay between requests. How do you do this? It’s as simple as:
time.Sleep(1 * time.Second)
Support Techcratic
If you find value in Techcratic’s insights and articles, consider supporting us with Bitcoin. Your support helps me, as a solo operator, continue delivering high-quality content while managing all the technical aspects, from server maintenance to blog writing, future updates, and improvements. Support Innovation! Thank you.
Bitcoin Address:
bc1qlszw7elx2qahjwvaryh0tkgg8y68enw30gpvge
Please verify this address before sending funds.
Bitcoin QR Code
Simply scan the QR code below to support Techcratic.
Please read the Privacy and Security Disclaimer on how Techcratic handles your support.
Disclaimer: As an Amazon Associate, Techcratic may earn from qualifying purchases.