| 166 | } |
| 167 | |
| 168 | func (r *remoteReporter) Close() { |
| 169 | r.closeMutex.Lock() |
| 170 | defer r.closeMutex.Unlock() |
| 171 | if r.isClosed() { |
| 172 | return |
| 173 | } |
| 174 | close(r.closed) |
| 175 | now := dbtime.Time(r.options.Clock.Now()).UTC() |
| 176 | r.shutdownAt = &now |
| 177 | if r.Enabled() { |
| 178 | // Report a final collection of telemetry prior to close! |
| 179 | // This could indicate final actions a user has taken, and |
| 180 | // the time the deployment was shutdown. |
| 181 | r.reportWithDeployment() |
| 182 | } |
| 183 | r.closeFunc() |
| 184 | } |
| 185 | |
| 186 | func (r *remoteReporter) isClosed() bool { |
| 187 | select { |