summaryrefslogtreecommitdiff
path: root/src/hub/src/spreadspace.org/sfive/s5srvForwardPiwik.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/hub/src/spreadspace.org/sfive/s5srvForwardPiwik.go')
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5srvForwardPiwik.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/hub/src/spreadspace.org/sfive/s5srvForwardPiwik.go b/src/hub/src/spreadspace.org/sfive/s5srvForwardPiwik.go
index 7dc034e..198a53c 100644
--- a/src/hub/src/spreadspace.org/sfive/s5srvForwardPiwik.go
+++ b/src/hub/src/spreadspace.org/sfive/s5srvForwardPiwik.go
@@ -62,17 +62,17 @@ tryResync:
// lastID, err := srv.forwardPiwikGetLastUpdateID(piwikURL, siteURL, siteID, token, client, hubUuid)
lastID, err := srv.store.GetLastUpdateID()
if err != nil {
- s5l.Printf("fwd-piwik: lastupdate returned err: %v", err)
+ s5l.Printf("srv|fwd-piwik: fetching lastupdate failed: %v", err)
time.Sleep(5 * time.Second)
continue tryResync
}
- s5l.Printf("fwd-piwik: lastupdate: %d", lastID)
+ s5l.Printf("srv|fwd-piwik: new lastupdate: %d", lastID)
nextBatch:
for {
updates, err := srv.store.GetUpdatesAfter(lastID, 5000)
if err != nil {
- s5l.Printf("fwd-piwik: failed reading updates: %v\n", err)
+ s5l.Printf("srv|fwd-piwik: reading updates failed: %v", err)
time.Sleep(500 * time.Millisecond)
continue nextBatch
}
@@ -114,26 +114,26 @@ tryResync:
postData := bytes.Buffer{}
if err := json.NewEncoder(&postData).Encode(req); err != nil {
- s5l.Panicf("fwd-piwik: encode failed: %v\n", err)
+ s5l.Panicf("srv|fwd-piwik: encoding updates failed: %v", err)
}
// TODO: move this to seperate function and read from io.PipeReader
resp, err := client.Post(piwikURL, "application/json", &postData)
if err != nil {
- s5l.Printf("fwd-piwik: post failed: %v\n", err)
+ s5l.Printf("srv|fwd-piwik: posting updates failed: %v", err)
time.Sleep(1 * time.Second)
continue tryResync
}
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
body, _ := ioutil.ReadAll(resp.Body)
- s5l.Printf("fwd-piwik: post failed: %s\n%s\n", resp.Status, body)
+ s5l.Printf("srv|fwd-piwik: posting updates failed: %s\n%s", resp.Status, body)
time.Sleep(1 * time.Second)
continue tryResync
}
resp.Body.Close() // TODO: check result from Piwik
lastID = findMaxID(updates)
- s5l.Printf("fwd-piwik: successfully forwarded %d updates, new lastid: %d", len(updates), lastID)
+ s5l.Printf("srv|fwd-piwik: successfully forwarded %d updates, new lastid: %d", len(updates), lastID)
}
}
}