(ctx context.Context, rawWorkspace string)
| 2439 | } |
| 2440 | |
| 2441 | func (h *BaseHandlers) memoryHealthWorkspaces(ctx context.Context, rawWorkspace string) ([]string, error) { |
| 2442 | if strings.TrimSpace(rawWorkspace) != "" { |
| 2443 | workspace, _, err := h.resolveMemoryWorkspaceRef(ctx, rawWorkspace) |
| 2444 | if err != nil { |
| 2445 | return nil, err |
| 2446 | } |
| 2447 | return []string{workspace}, nil |
| 2448 | } |
| 2449 | |
| 2450 | infos, err := h.Sessions.ListAll(ctx) |
| 2451 | if err != nil { |
| 2452 | return nil, err |
| 2453 | } |
| 2454 | |
| 2455 | workspaces := make([]string, 0, len(infos)) |
| 2456 | seen := make(map[string]struct{}, len(infos)) |
| 2457 | for _, info := range infos { |
| 2458 | if info == nil || strings.TrimSpace(info.Workspace) == "" { |
| 2459 | continue |
| 2460 | } |
| 2461 | workspace, err := resolveMemoryWorkspace(info.Workspace) |
| 2462 | if err != nil { |
| 2463 | return nil, err |
| 2464 | } |
| 2465 | if _, exists := seen[workspace]; exists { |
| 2466 | continue |
| 2467 | } |
| 2468 | seen[workspace] = struct{}{} |
| 2469 | workspaces = append(workspaces, workspace) |
| 2470 | } |
| 2471 | |
| 2472 | return workspaces, nil |
| 2473 | } |
| 2474 | |
| 2475 | // MemoryHealthWorkspaces returns the workspaces considered for memory health checks. |
| 2476 | func (h *BaseHandlers) MemoryHealthWorkspaces(ctx context.Context, rawWorkspace string) ([]string, error) { |
no test coverage detected