diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-06-06 02:20:38 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-06-06 02:22:54 -0400 |
commit | 1a15258ee5d93ffef8f8c768ff725d7429a3248c (patch) | |
tree | 9a89321ce5c84509ec778cad3b9abb983026fc8b /svc/cache.go | |
parent | 7a75c4fc399a1c8e545e9e8d77ecf5bae54a3b96 (diff) | |
download | getwtxt-1a15258ee5d93ffef8f8c768ff725d7429a3248c.tar.gz |
renamed functions
Diffstat (limited to 'svc/cache.go')
-rw-r--r-- | svc/cache.go | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/svc/cache.go b/svc/cache.go index ce3813c..fb6a9ab 100644 --- a/svc/cache.go +++ b/svc/cache.go @@ -8,7 +8,7 @@ import ( "time" ) -func checkCacheTime() bool { +func cacheTimer() bool { confObj.Mu.RLock() answer := time.Since(confObj.LastCache) > confObj.CacheInterval confObj.Mu.RUnlock() @@ -20,11 +20,11 @@ func checkCacheTime() bool { // for the update intervals to pass. func cacheAndPush() { for { - if checkCacheTime() { + if cacheTimer() { refreshCache() } - if checkDBtime() { - if err := pushDatabase(); err != nil { + if dbTimer() { + if err := pushDB(); err != nil { log.Printf("Error pushing cache to database: %v\n", err.Error()) } } @@ -113,18 +113,3 @@ func pingAssets() { staticCache.cssMod = cssStat.ModTime() } } - -// Simple function to deduplicate entries in a []string -func dedupe(list []string) []string { - var out []string - var seen = map[string]bool{} - - for _, e := range list { - if !seen[e] { - out = append(out, e) - seen[e] = true - } - } - - return out -} |