MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / parseOpenclawCronCount

Function parseOpenclawCronCount

agent/app/service/agents_overview.go:172–194  ·  view source on GitHub ↗
(output string)

Source from the content-addressed store, hash-verified

170}
171
172func parseOpenclawCronCount(output string) (int, error) {
173 if strings.TrimSpace(output) == "" {
174 return 0, nil
175 }
176 var payload interface{}
177 if err := json.Unmarshal([]byte(strings.TrimSpace(output)), &payload); err != nil {
178 return 0, err
179 }
180 switch value := payload.(type) {
181 case []interface{}:
182 return len(value), nil
183 case map[string]interface{}:
184 if total, ok := value["total"].(float64); ok {
185 return int(total), nil
186 }
187 if jobs, ok := value["jobs"].([]interface{}); ok {
188 return len(jobs), nil
189 }
190 return len(value), nil
191 default:
192 return 0, nil
193 }
194}
195
196func countOpenclawSessions(payload interface{}) int {
197 switch value := payload.(type) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected