summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2018-03-10 04:42:22 +0100
committerChristian Pointner <equinox@spreadspace.org>2018-03-10 04:42:22 +0100
commit6e6ef6f437706cce265352a034dd19e0039e149e (patch)
treea4fe8a82d0a6483ef0b9662f03382e9269ee4ec2
parentadded todo (diff)
fix bug in forwarder id handling
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5srvForwardPiwik.go8
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5srvForwardSfive.go6
2 files changed, 9 insertions, 5 deletions
diff --git a/src/hub/src/spreadspace.org/sfive/s5srvForwardPiwik.go b/src/hub/src/spreadspace.org/sfive/s5srvForwardPiwik.go
index 93b717b..aac94e1 100644
--- a/src/hub/src/spreadspace.org/sfive/s5srvForwardPiwik.go
+++ b/src/hub/src/spreadspace.org/sfive/s5srvForwardPiwik.go
@@ -49,17 +49,17 @@ type forwardPiwikBulkRequest struct {
TokenAuth string `json:"token_auth"`
}
-func fwdPiwikGetLastUpdateID(piwikURL, siteURL string, siteID uint, token string, client *http.Client, hubUuid string) (lastID int, err error) {
+func fwdPiwikGetLastUpdateID(piwikURL, siteURL string, siteID uint, token string, client *http.Client, hubUUID string) (lastID int64, err error) {
// TODO: ask piwik what the last update was...
lastID = 0
return
}
func (srv *Server) forwardPiwikRun(piwikURL, siteURL string, siteID uint, token string, client *http.Client) {
- // hubUuid := srv.store.GetHubUuid()
+ // hubUUID := srv.store.GetHubUUID()
tryResync:
for {
- // lastID, err := srv.forwardPiwikGetLastUpdateID(piwikURL, siteURL, siteID, token, client, hubUuid)
+ // lastID, err := fwdPiwikGetLastUpdateID(piwikURL, siteURL, siteID, token, client, hubUUID)
lastID, err := srv.store.GetLastUpdateID()
if err != nil {
s5l.Printf("srv|fwd-piwik: fetching lastupdate failed: %v", err)
@@ -70,7 +70,7 @@ tryResync:
nextBatch:
for {
- updates, err := srv.store.GetUpdatesAfter(lastID, 5000)
+ updates, err := srv.store.GetUpdatesAfter(lastID, 500)
if err != nil {
s5l.Printf("srv|fwd-piwik: reading updates failed: %v", err)
time.Sleep(500 * time.Millisecond)
diff --git a/src/hub/src/spreadspace.org/sfive/s5srvForwardSfive.go b/src/hub/src/spreadspace.org/sfive/s5srvForwardSfive.go
index 0e0a7e6..0c9c82c 100644
--- a/src/hub/src/spreadspace.org/sfive/s5srvForwardSfive.go
+++ b/src/hub/src/spreadspace.org/sfive/s5srvForwardSfive.go
@@ -44,7 +44,11 @@ import (
func findMaxID(updates []*UpdateFull) int64 {
maxID := int64(-1)
for _, value := range updates {
- if id := value.SourceHubUpdateID; id > maxID {
+ id := value.SourceHubUpdateID
+ if value.ForwardHubUUID != "" { // we are not the source but the forwarder
+ id = value.ForwardHubUpdateID
+ }
+ if id > maxID {
maxID = id
}
}