diff options
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 30 |
1 files changed, 13 insertions, 17 deletions
@@ -262,25 +262,21 @@ func poll(w http.ResponseWriter, r *http.Request) { http.Error(w, err.String(), http.StatusInternalServerError) return } - var update *Update - for i := 0; i < 30; i++ { - update = getUpdates(q.Get("pid"), timestamp) - if update != nil { - w.Write([]byte("[")) - for update != nil { - output, err := json.MarshalForHTML(update) - if err == nil { - w.Write(output) - } - update = update.Next - if update != nil { - w.Write([]byte(",")) - } + update := getUpdates(q.Get("pid"), timestamp) + if update != nil { + w.Write([]byte("[")) + for update != nil { + output, err := json.MarshalForHTML(update) + if err == nil { + w.Write(output) + } + update = update.Next + if update != nil { + w.Write([]byte(",")) } - w.Write([]byte("]")) - return } - time.Sleep(1e9) // 1 second + w.Write([]byte("]")) + return } w.Write([]byte("[]")) } |