File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
components/ws-proxy/pkg/proxy Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ package proxy
7
7
import (
8
8
"context"
9
9
"net/url"
10
+ "sort"
10
11
"time"
11
12
12
13
"golang.org/x/xerrors"
@@ -122,7 +123,18 @@ func (r *CRDWorkspaceInfoProvider) WorkspaceInfo(workspaceID string) *WorkspaceI
122
123
return nil
123
124
}
124
125
125
- if len (workspaces ) == 1 {
126
+ if len (workspaces ) >= 1 {
127
+ if len (workspaces ) != 1 {
128
+ log .Warnf ("multiple instances (%d) for workspace %s" , len (workspaces ), workspaceID )
129
+ }
130
+
131
+ sort .Slice (workspaces , func (i , j int ) bool {
132
+ a := workspaces [i ].(* WorkspaceInfo )
133
+ b := workspaces [j ].(* WorkspaceInfo )
134
+
135
+ return a .StartedAt .After (b .StartedAt )
136
+ })
137
+
126
138
return workspaces [0 ].(* WorkspaceInfo )
127
139
}
128
140
You can’t perform that action at this time.
0 commit comments