MCPcopy Index your code
hub / github.com/coder/coder / updateConnectionTimes

Method updateConnectionTimes

coderd/workspaceagentsrpc.go:336–353  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

334}
335
336func (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
355func (m *agentConnectionMonitor) init() {
356 now := dbtime.Now()

Callers 1

monitorMethod · 0.95

Calls 4

AsSystemRestrictedFunction · 0.92
NowFunction · 0.92
ErrorfMethod · 0.45

Tested by

no test coverage detected