Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit91ce016

Browse files
committed
add ready function to container api
1 parentfd69221 commit91ce016

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

‎agent/agent.go

Lines changed: 4 additions & 3 deletions
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
ifa.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
iferr!=nil {

‎agent/agentcontainers/api.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,11 @@ func NewAPI(logger slog.Logger, options ...Option) *API {
151151
returnapi
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ func TestAPI(t *testing.T) {
634634
)
635635
deferapi.Close()
636636

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp