summaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorraylu <raylu@mixpanel.com>2011-08-08 02:47:10 -0700
committerraylu <raylu@mixpanel.com>2011-08-08 02:47:10 -0700
commit578e1a2e6c83aa4cfc8686b25f899db863f09f10 (patch)
treec6211618655a50381a36bb87ccf67dd5177fab58 /main.go
parent0164e2515ae5ff6cedf37c4ae8344eae4d1b9b94 (diff)
downloadaudioaxis-578e1a2e6c83aa4cfc8686b25f899db863f09f10.tar.xz
redo update code
Diffstat (limited to 'main.go')
-rw-r--r--main.go30
1 files changed, 13 insertions, 17 deletions
diff --git a/main.go b/main.go
index 21af0a8..de39411 100644
--- a/main.go
+++ b/main.go
@@ -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("[]"))
}