summary refs log tree commit diff stats
path: root/svc
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-06-07 00:59:20 -0400
committerBen Morrison <ben@gbmor.dev>2019-06-08 02:29:24 -0400
commit3eb5a0321ea6e70a7ad3234efc9a0c1263833389 (patch)
tree1399caedd54e252bace000329107653334736f8a /svc
parent6c1b09bbeb1a7268a0d590e0a20ab2d34b395c8f (diff)
downloadgetwtxt-3eb5a0321ea6e70a7ad3234efc9a0c1263833389.tar.gz
added User.RLen to leveldb push/pull
Diffstat (limited to 'svc')
-rw-r--r--svc/db.go13
1 files 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":