(doneChan chan struct{})
| 134 | } |
| 135 | |
| 136 | func (u *upstream) startPing(doneChan chan struct{}) { |
| 137 | go func() { |
| 138 | for { |
| 139 | select { |
| 140 | case <-doneChan: |
| 141 | return |
| 142 | case <-time.After(time.Second * 15): |
| 143 | if u.client != nil { |
| 144 | ctx, cancel := context.WithTimeout(u.sync.ctx, time.Second*15) |
| 145 | _, err := u.client.Ping(ctx, &remote.Empty{}) |
| 146 | cancel() |
| 147 | if err != nil { |
| 148 | u.sync.Stop(fmt.Errorf("ping connection: %v", err)) |
| 149 | return |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | } |
| 154 | }() |
| 155 | } |
| 156 | |
| 157 | func (u *upstream) startEventsLoop(doneChan chan struct{}) { |
| 158 | go func() { |
no test coverage detected