feat: add waitGroup

This commit is contained in:
langhuihui
2023-06-08 09:34:00 +08:00
parent 28a51b9b60
commit ac7a26c6e2
5 changed files with 13 additions and 2 deletions

View File

@@ -53,6 +53,8 @@ func (conf *GlobalConfig) API_summary(rw http.ResponseWriter, r *http.Request) {
if !summary.Running() {
summary.collect()
}
summary.rw.RLock()
defer summary.rw.RUnlock()
if y {
if err := yaml.NewEncoder(rw).Encode(&summary); err != nil {
http.Error(rw, err.Error(), http.StatusInternalServerError)