diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-06-13 23:58:17 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-06-13 23:58:22 -0400 |
commit | df8fa27ffa596e02d0560aa9238f194911c03e56 (patch) | |
tree | 882ddbc7cfa6be1123a77fc84b01c124623707d4 /svc/db.go | |
parent | c4130e200d1282c1637c6f79332593026c87993d (diff) | |
download | getwtxt-df8fa27ffa596e02d0560aa9238f194911c03e56.tar.gz |
on SIGINT, push to DB before shutting down
also logging elapsed time for DB pulls
Diffstat (limited to 'svc/db.go')
-rw-r--r-- | svc/db.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/svc/db.go b/svc/db.go index 260c5cc..2156f40 100644 --- a/svc/db.go +++ b/svc/db.go @@ -1,6 +1,9 @@ package svc // import "github.com/getwtxt/getwtxt/svc" import ( + "log" + "time" + "github.com/syndtr/goleveldb/leveldb" "golang.org/x/sys/unix" ) @@ -68,7 +71,9 @@ func pushDB() error { // Reads the database from disk into memory. func pullDB() { + start := time.Now() db := <-dbChan db.pull() dbChan <- db + log.Printf("Database pull took: %v\n", time.Since(start)) } |