mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-06-02 12:32:23 +00:00
6ed1655ce3
Co-authored-by: pat-s <patrick.schratz@gmail.com>
22 lines
432 B
Go
22 lines
432 B
Go
package api
|
|
|
|
import (
|
|
"encoding/json"
|
|
"log"
|
|
"net/http"
|
|
|
|
"go.woodpecker-ci.org/woodpecker/v2/server/queue" // replace with the actual import path
|
|
)
|
|
|
|
func GetQueueStats() {
|
|
http.HandleFunc("/api/queue/stats", func(w http.ResponseWriter, r *http.Request) {
|
|
var stats queue.InfoT
|
|
err := json.NewEncoder(w).Encode(stats)
|
|
if err != nil {
|
|
// handle the error
|
|
log.Printf("Error encoding JSON: %v", err)
|
|
return
|
|
}
|
|
})
|
|
}
|