Thank you a lot, Diego! 
I decided to implement this exatctly as you said (one goroutine for list of 
pairs user:location), and this is much more correct. 

понедельник, 20 февраля 2017 г., 4:27:10 UTC+3 пользователь Diego Medina 
написал:
>
> Hi,
>
> Instead of starting them from an http handler, I would store in the 
> database the locations and their users. Then, from main() I would start 
> just one go routine that will check the db for any pending location that 
> needs to be fetched, if found, then go do work, sleep for x seconds, then 
> check the database again.
>
> That way, when a user no longer wants to be notified about location Z, you 
> just remove their user from the database and then go routine will not find 
> it any more.
>
> Thanks
>
>
>
>
> -- 
> Diego Medina
> Lift/Scala Consultant
> di...@fmpwizard.com <javascript:>
> https://blog.fmpwizard.com/
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to