Skip to content

Commit 17fa155

Browse files
committed
rename start to ready
1 parent fd69221 commit 17fa155

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

agent/agent.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -1169,9 +1169,10 @@ func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context,
11691169
a.metrics.startupScriptSeconds.WithLabelValues(label).Set(dur)
11701170
a.scriptRunner.StartCron()
11711171
if a.containerAPI != nil {
1172-
// Start the containerAPI service after
1173-
// devcontainers have been started.
1174-
a.containerAPI.Start()
1172+
// Inform the container API that the agent is ready.
1173+
// This allows us to start watching for changes to
1174+
// the devcontainer configuration files.
1175+
a.containerAPI.Ready()
11751176
}
11761177
})
11771178
if err != nil {

agent/agentcontainers/api.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,11 @@ func NewAPI(logger slog.Logger, options ...Option) *API {
151151
return api
152152
}
153153

154-
// Start watching for devcontainer config file changes and prime the
155-
// cache with the current list of containers.
156-
func (api *API) Start() {
154+
// Ready signals the API that we are ready to begin watching for file
155+
// changes. This is used to prime the cache with the current list of
156+
// containers and to start watching the devcontainer config files for
157+
// changes. It should be called after the agent ready.
158+
func (api *API) Ready() {
157159
// Prime the cache with the current list of containers.
158160
_, _ = api.cl.List(api.ctx)
159161

agent/agentcontainers/api_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ func TestAPI(t *testing.T) {
634634
)
635635
defer api.Close()
636636

637-
api.Start()
637+
api.Ready()
638638

639639
r := chi.NewRouter()
640640
r.Mount("/", api.Routes())

0 commit comments

Comments
 (0)