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)
| 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. |
| 1572 | func (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 |
no test coverage detected