Question: Why time.After instead of time.Sleep ?
dev-drprasad opened this issue · comments
I learned lot from your article on load balancer. I see you used select
with time.After
to retry
Lines 185 to 192 in fd45a98
Why not just use time.Sleep
? Is there any difference between time.Sleep
and select
with time.After
?
Main purpose to add time.After
to have a flexible structure to run other concurrent tasks in the error handler.
It's ok to use time.Sleep as well, in that case, we cant interrupt it