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

Method markDevcontainerDirty

agent/agentcontainers/api.go:1572–1608  ·  view source on GitHub ↗

markDevcontainerDirty finds the devcontainer with the given config file path and marks it as dirty. It acquires the lock before modifying the state.

(configPath string, modifiedAt time.Time)

Source from the content-addressed store, hash-verified

1570// markDevcontainerDirty finds the devcontainer with the given config file path
1571// and marks it as dirty. It acquires the lock before modifying the state.
1572func (api *API) markDevcontainerDirty(configPath string, modifiedAt time.Time) {
1573 api.mu.Lock()
1574 defer api.mu.Unlock()
1575
1576 // Record the timestamp of when this configuration file was modified.
1577 api.configFileModifiedTimes[configPath] = modifiedAt
1578
1579 for _, dc := range api.knownDevcontainers {
1580 if dc.ConfigPath != configPath {
1581 continue
1582 }
1583
1584 logger := api.logger.With(
1585 slog.F("devcontainer_id", dc.ID),
1586 slog.F("devcontainer_name", dc.Name),
1587 slog.F("workspace_folder", dc.WorkspaceFolder),
1588 slog.F("file", configPath),
1589 slog.F("modified_at", modifiedAt),
1590 )
1591
1592 // TODO(mafredri): Simplistic mark for now, we should check if the
1593 // container is running and if the config file was modified after
1594 // the container was created.
1595 if !dc.Dirty {
1596 logger.Info(api.ctx, "marking devcontainer as dirty")
1597 dc.Dirty = true
1598 }
1599 if _, ok := api.ignoredDevcontainers[dc.WorkspaceFolder]; ok {
1600 logger.Debug(api.ctx, "clearing devcontainer ignored state")
1601 delete(api.ignoredDevcontainers, dc.WorkspaceFolder) // Allow re-reading config.
1602 }
1603
1604 api.knownDevcontainers[dc.WorkspaceFolder] = dc
1605 }
1606
1607 api.broadcastUpdatesLocked()
1608}
1609
1610// cleanupSubAgents removes subagents that are no longer managed by
1611// this agent. This is usually only run at startup to ensure a clean

Callers 1

watcherLoopMethod · 0.95

Calls 4

LockMethod · 0.45
UnlockMethod · 0.45
InfoMethod · 0.45

Tested by

no test coverage detected