(ctx context.Context)
| 334 | } |
| 335 | |
| 336 | func (m *agentConnectionMonitor) updateConnectionTimes(ctx context.Context) error { |
| 337 | //nolint:gocritic // We only update the agent we are minding. |
| 338 | err := m.db.UpdateWorkspaceAgentConnectionByID(dbauthz.AsSystemRestricted(ctx), database.UpdateWorkspaceAgentConnectionByIDParams{ |
| 339 | ID: m.workspaceAgent.ID, |
| 340 | FirstConnectedAt: m.firstConnectedAt, |
| 341 | LastConnectedAt: m.lastConnectedAt, |
| 342 | DisconnectedAt: m.disconnectedAt, |
| 343 | UpdatedAt: dbtime.Now(), |
| 344 | LastConnectedReplicaID: uuid.NullUUID{ |
| 345 | UUID: m.replicaID, |
| 346 | Valid: true, |
| 347 | }, |
| 348 | }) |
| 349 | if err != nil { |
| 350 | return xerrors.Errorf("failed to update workspace agent connection times: %w", err) |
| 351 | } |
| 352 | return nil |
| 353 | } |
| 354 | |
| 355 | func (m *agentConnectionMonitor) init() { |
| 356 | now := dbtime.Now() |
no test coverage detected