diff options
author | raylu <raylu@mixpanel.com> | 2011-08-08 02:47:10 -0700 |
---|---|---|
committer | raylu <raylu@mixpanel.com> | 2011-08-08 02:47:10 -0700 |
commit | 578e1a2e6c83aa4cfc8686b25f899db863f09f10 (patch) | |
tree | c6211618655a50381a36bb87ccf67dd5177fab58 /main.go | |
parent | 0164e2515ae5ff6cedf37c4ae8344eae4d1b9b94 (diff) | |
download | audioaxis-578e1a2e6c83aa4cfc8686b25f899db863f09f10.tar.xz |
redo update code
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("[]")) } |