From 3eb5a0321ea6e70a7ad3234efc9a0c1263833389 Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Fri, 7 Jun 2019 00:59:20 -0400 Subject: added User.RLen to leveldb push/pull --- svc/db.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/svc/db.go b/svc/db.go index a6ddf18..6a614f1 100644 --- a/svc/db.go +++ b/svc/db.go @@ -93,10 +93,13 @@ func (lvl dbLevel) push() error { twtxtCache.Mu.RLock() var dbBasket = &leveldb.Batch{} for k, v := range twtxtCache.Users { + dbBasket.Put([]byte(k+"*Nick"), []byte(v.Nick)) dbBasket.Put([]byte(k+"*URL"), []byte(v.URL)) dbBasket.Put([]byte(k+"*IP"), []byte(v.IP.String())) dbBasket.Put([]byte(k+"*Date"), []byte(v.Date)) + dbBasket.Put([]byte(k+"*RLen"), []byte(v.RLen)) + for i, e := range v.Status { rfc := i.Format(time.RFC3339) dbBasket.Put([]byte(k+"*Status*"+rfc), []byte(e)) @@ -110,15 +113,13 @@ func (lvl dbLevel) push() error { } remoteRegistries.Mu.RUnlock() - if err := lvl.db.Write(dbBasket, nil); err != nil { - return err - } - confObj.Mu.Lock() confObj.LastPush = time.Now() confObj.Mu.Unlock() - return nil + err := lvl.db.Write(dbBasket, nil) + + return err } func (lvl dbLevel) pull() { @@ -154,6 +155,8 @@ func (lvl dbLevel) pull() { data.Nick = val case "URL": data.URL = val + case "RLen": + data.RLen = val case "Date": data.Date = val case "Status": -- cgit 1.4.1-2-gfad0