Skip to content

Commit 274a600

Browse files
committed
refactoring getAppStatus
1 parent a5d8f3d commit 274a600

File tree

3 files changed

+2
-21
lines changed

3 files changed

+2
-21
lines changed

internal/orchestrator/app_status.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,6 @@ func parseDockerStatusEvent(ctx context.Context, cfg config.Configuration, docke
8686
if err != nil {
8787
return AppInfo{}, err
8888
}
89-
90-
if appStatus == nil {
91-
return AppInfo{}, fmt.Errorf("app containers not found for: %s", pathLabel)
92-
}
93-
9489
defaultApp, err := GetDefaultApp(cfg)
9590
if err != nil {
9691
slog.Warn("unable to get default app", slog.String("error", err.Error()))

internal/orchestrator/helpers.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"strings"
2424

2525
"github.com/arduino/go-paths-helper"
26-
"github.com/docker/cli/cli/command"
2726
"github.com/docker/docker/api/types/container"
2827
"github.com/docker/docker/api/types/filters"
2928
dockerClient "github.com/docker/docker/client"
@@ -163,19 +162,6 @@ func getAppStatusByPath(
163162
return &app[0], nil
164163
}
165164

166-
func getAppStatus(
167-
ctx context.Context,
168-
docker command.Cli,
169-
app app.ArduinoApp,
170-
) (AppStatusInfo, error) {
171-
statusInfo, err := getAppStatusByPath(ctx, docker.Client(), app.FullPath.String())
172-
173-
if err != nil {
174-
return AppStatusInfo{}, fmt.Errorf("failed to get app status: %w", err)
175-
}
176-
return *statusInfo, nil
177-
}
178-
179165
func getRunningApp(
180166
ctx context.Context,
181167
docker dockerClient.APIClient,

internal/orchestrator/orchestrator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ func stopAppWithCmd(ctx context.Context, docker command.Cli, app app.ArduinoApp,
420420

421421
if _, ok := app.GetSketchPath(); ok {
422422
// Before stopping the microcontroller we want to make sure that the app was running.
423-
appStatus, err := getAppStatus(ctx, docker, app)
423+
appStatus, err := getAppStatusByPath(ctx, docker.Client(), app.FullPath.String())
424424
if err != nil {
425425
yield(StreamMessage{error: err})
426426
return
@@ -761,7 +761,7 @@ func AppDetails(
761761
var status Status
762762
go func() {
763763
defer wg.Done()
764-
app, err := getAppStatus(ctx, docker, userApp)
764+
app, err := getAppStatusByPath(ctx, docker.Client(), userApp.FullPath.String())
765765
if err != nil {
766766
slog.Warn("unable to get app status", slog.String("error", err.Error()), slog.String("path", userApp.FullPath.String()))
767767
status = StatusStopped

0 commit comments

Comments
 (0)