diff options
author | Markus Grüneis <gimpf@gimpf.org> | 2014-10-24 23:32:29 +0200 |
---|---|---|
committer | Markus Grüneis <gimpf@gimpf.org> | 2014-10-24 23:32:29 +0200 |
commit | ee954611c0045db034dc444aecccbbd8c17e7bb6 (patch) | |
tree | 1d4172b9035d1ea5341d76acfb904ba183b102d1 /src/hub/src | |
parent | hub: add LIMIT to GetUpdatesAfter, API filter struct (diff) |
hub: Add retry to DB append in case of error.
Diffstat (limited to 'src/hub/src')
-rw-r--r-- | src/hub/src/spreadspace.org/sfive/s5srv.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/hub/src/spreadspace.org/sfive/s5srv.go b/src/hub/src/spreadspace.org/sfive/s5srv.go index 59a6409..6647518 100644 --- a/src/hub/src/spreadspace.org/sfive/s5srv.go +++ b/src/hub/src/spreadspace.org/sfive/s5srv.go @@ -1,5 +1,7 @@ package sfive +import "time" + type appendManyToken struct { data []StatisticsData response chan bool @@ -20,7 +22,15 @@ func (self StatsSinkServer) appendActor() { case <-self.quit: return case value := <-self.appendData: - err := self.store.Append(value) + var err error + for tryNum := 0; tryNum < 5; tryNum++ { + err = self.store.Append(value) + if err != nil { + time.Sleep(1 * time.Second) + } else { + break + } + } if err != nil { s5l.Printf("failed to store data: %v\n", err) } |