fix(coderd/healthcheck): do not return null regions in RegionsResponse (#11088)

This commit is contained in:
Cian Johnston
2023-12-07 21:10:12 +00:00
committed by GitHub
parent 228cbec99b
commit 51687c74c8
+4
View File
@@ -77,6 +77,10 @@ func (r *WorkspaceProxyReport) Run(ctx context.Context, opts *WorkspaceProxyRepo
}
r.WorkspaceProxies = proxies
if r.WorkspaceProxies.Regions == nil {
r.WorkspaceProxies.Regions = make([]codersdk.WorkspaceProxy, 0)
}
// Stable sort based on create timestamp.
sort.Slice(r.WorkspaceProxies.Regions, func(i int, j int) bool {
return r.WorkspaceProxies.Regions[i].CreatedAt.Before(r.WorkspaceProxies.Regions[j].CreatedAt)