I have this code:
for _, v := range sams {
sam := v
pid := getPracticeIdBySam(db, sam)
go func() {
defer wg.Done()
for _, v := range pid {
process(db, stmt, v, min_year, max_year, bar)
}
}()
}
It iterates through the first "pid", however it stops there. Is there a reason for this?
I found out the reason. It is because I had wg.Wait()
in process
which in turn caused it to hang.