summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Grüneis <gimpf@gimpf.org>2014-10-24 15:38:32 +0200
committerMarkus Grüneis <gimpf@gimpf.org>2014-10-24 15:38:32 +0200
commit155766e1bd291bd2a7dccf330b30993631a9303a (patch)
treebe763c9fb93d5526ae27aa979f3732c2afc4780b
parenthub: Support posting multiple updates at once via http. (diff)
hub: Post all available updates at once in fwd.
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5srvForward.go38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/hub/src/spreadspace.org/sfive/s5srvForward.go b/src/hub/src/spreadspace.org/sfive/s5srvForward.go
index 475027a..4707dd5 100644
--- a/src/hub/src/spreadspace.org/sfive/s5srvForward.go
+++ b/src/hub/src/spreadspace.org/sfive/s5srvForward.go
@@ -69,28 +69,28 @@ tryResync:
continue nextBatch
}
- for i := range updates {
- data, err := json.Marshal(updates[i])
- if err != nil {
- s5l.Panicf("fwd: encode failed: %v\n", err)
- // TODO retry etc.
- }
-
- _, err = client.Post(url, "application/json", bytes.NewBuffer(data))
- if err != nil {
- s5l.Printf("fwd: post failed: %v\n", err)
- continue tryResync
- // TODO retry etc.
- }
- }
-
if len(updates) == 0 {
time.Sleep(1 * time.Second)
- } else {
- lastId = findMaxId(updates)
- s5tl.Printf("fwd: new lastid: %d", lastId)
- time.Sleep(100 * time.Millisecond)
+ continue nextBatch
}
+
+ data, err := json.Marshal(StatisticsDataContainer{updates})
+
+ if err != nil {
+ s5l.Panicf("fwd: encode failed: %v\n", err)
+ }
+
+ _, err = client.Post(url, "application/json", bytes.NewBuffer(data))
+ if err != nil {
+ s5l.Printf("fwd: post failed: %v\n", err)
+ continue tryResync
+ // TODO retry etc.
+ }
+ // }
+
+ lastId = findMaxId(updates)
+ s5tl.Printf("fwd: new lastid: %d", lastId)
+ time.Sleep(100 * time.Millisecond)
}
}
}