(ctx context.Context)
| 57 | } |
| 58 | |
| 59 | func (t *Tracker) Wait(ctx context.Context) { |
| 60 | ch := make(chan struct{}) |
| 61 | |
| 62 | go func() { |
| 63 | t.wg.Wait() |
| 64 | close(ch) |
| 65 | }() |
| 66 | |
| 67 | select { |
| 68 | case <-ch: // Waitgroup is done. |
| 69 | return |
| 70 | case <-ctx.Done(): |
| 71 | return |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | func (t *Tracker) track(eventName string, id string, properties map[string]string) { |
| 76 | if !shouldTrack() { |
no outgoing calls