Stop Spawning Infinite Goroutines: Use Tee-Channels in Go for Scalable Event Handling
Imagine you're working on an app that allows users to sign up for free. But you also want to make sure that someone from the sales team follows up to nudge the user to subscribe. So you have two tasks after the user is successfully signed up: Send a welcome email to the user. Notify the sales team on Slack. Naturally, your first version looks something like this: User signs up You send a welcome email Once that's successful, you notify the sales team Sounds clean. But here's the thing - you've now tied the success of the sales notification to the welcome email, which is not just a coupling nightmare, it's also a recipe for "Oops, we never told the sales team." ⚠️ The Goroutine Trap: Scaling Gone Wild So you think, "Let's parallelise it! Fire two goroutines!" Great. Until… You host a workshop, and suddenly, a hundred thousand users are signing up. Now your server is firing two goroutines per user and context switching like it's in a dance battle. CPU usage spikes, latency increases, and your devops team starts slacking you

Imagine you're working on an app that allows users to sign up for free. But you also want to make sure that someone from the sales team follows up to nudge the user to subscribe. So you have two tasks after the user is successfully signed up:
- Send a welcome email to the user.
- Notify the sales team on Slack.
Naturally, your first version looks something like this:
- User signs up
- You send a welcome email
- Once that's successful, you notify the sales team
Sounds clean.
But here's the thing - you've now tied the success of the sales notification to the welcome email, which is not just a coupling nightmare, it's also a recipe for "Oops, we never told the sales team."
⚠️ The Goroutine Trap: Scaling Gone Wild
So you think, "Let's parallelise it! Fire two goroutines!"
Great. Until…
You host a workshop, and suddenly, a hundred thousand users are signing up.
Now your server is firing two goroutines per user and context switching like it's in a dance battle. CPU usage spikes, latency increases, and your devops team starts slacking you