(p database.WorkspaceProxy, status proxyhealth.ProxyStatus)
| 982 | } |
| 983 | |
| 984 | func convertProxy(p database.WorkspaceProxy, status proxyhealth.ProxyStatus) codersdk.WorkspaceProxy { |
| 985 | now := dbtime.Now() |
| 986 | if p.IsPrimary() { |
| 987 | status = proxyhealth.ProxyStatus{ |
| 988 | Proxy: p, |
| 989 | Status: proxyhealth.Healthy, |
| 990 | Report: codersdk.ProxyHealthReport{}, |
| 991 | CheckedAt: now, |
| 992 | } |
| 993 | // For primary, created at / updated at are always 'now' |
| 994 | p.CreatedAt = now |
| 995 | p.UpdatedAt = now |
| 996 | } |
| 997 | if status.Status == "" { |
| 998 | status.Status = proxyhealth.Unknown |
| 999 | } |
| 1000 | if status.Report.Errors == nil { |
| 1001 | status.Report.Errors = make([]string, 0) |
| 1002 | } |
| 1003 | if status.Report.Warnings == nil { |
| 1004 | status.Report.Warnings = make([]string, 0) |
| 1005 | } |
| 1006 | return codersdk.WorkspaceProxy{ |
| 1007 | Region: convertRegion(p, status), |
| 1008 | DerpEnabled: p.DerpEnabled, |
| 1009 | DerpOnly: p.DerpOnly, |
| 1010 | CreatedAt: p.CreatedAt, |
| 1011 | UpdatedAt: p.UpdatedAt, |
| 1012 | Deleted: p.Deleted, |
| 1013 | Version: p.Version, |
| 1014 | Status: codersdk.WorkspaceProxyStatus{ |
| 1015 | Status: codersdk.ProxyHealthStatus(status.Status), |
| 1016 | Report: status.Report, |
| 1017 | CheckedAt: status.CheckedAt, |
| 1018 | }, |
| 1019 | } |
| 1020 | } |
| 1021 | |
| 1022 | // workspaceProxiesFetchUpdater implements healthcheck.WorkspaceProxyFetchUpdater |
| 1023 | // in an actually useful and meaningful way. |
no test coverage detected