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

Method agent

coderd/agentapi/api.go:292–298  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

290}
291
292func (a *API) agent(ctx context.Context) (database.WorkspaceAgent, error) {
293 agent, err := a.opts.Database.GetWorkspaceAgentByID(ctx, a.opts.AgentID)
294 if err != nil {
295 return database.WorkspaceAgent{}, xerrors.Errorf("get workspace agent by id %q: %w", a.opts.AgentID, err)
296 }
297 return agent, nil
298}
299
300// refreshCachedWorkspace periodically updates the cached workspace fields.
301// This ensures that changes like prebuild claims (which modify owner_id, name, etc.)

Callers

nothing calls this directly

Calls 2

GetWorkspaceAgentByIDMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected