(c *gin.Context)
| 128 | } |
| 129 | |
| 130 | func GetUptimeKumaStatus(c *gin.Context) { |
| 131 | groups := console_setting.GetUptimeKumaGroups() |
| 132 | if len(groups) == 0 { |
| 133 | c.JSON(http.StatusOK, gin.H{"success": true, "message": "", "data": []UptimeGroupResult{}}) |
| 134 | return |
| 135 | } |
| 136 | |
| 137 | ctx, cancel := context.WithTimeout(c.Request.Context(), requestTimeout) |
| 138 | defer cancel() |
| 139 | |
| 140 | client := &http.Client{Timeout: httpTimeout} |
| 141 | results := make([]UptimeGroupResult, len(groups)) |
| 142 | |
| 143 | g, gCtx := errgroup.WithContext(ctx) |
| 144 | for i, group := range groups { |
| 145 | i, group := i, group |
| 146 | g.Go(func() error { |
| 147 | results[i] = fetchGroupData(gCtx, client, group) |
| 148 | return nil |
| 149 | }) |
| 150 | } |
| 151 | |
| 152 | g.Wait() |
| 153 | c.JSON(http.StatusOK, gin.H{"success": true, "message": "", "data": results}) |
| 154 | } |
nothing calls this directly
no test coverage detected