diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-06-11 04:48:01 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-06-11 04:54:55 -0400 |
commit | fb328631e55830f3a2cab79bf18115324910c93c (patch) | |
tree | ce92b5e91f1588bd5dcafdd466c368f37bf5d2de /svc/init.go | |
parent | 00eaadc6ed2859ccf3683486667fe20374893421 (diff) | |
download | getwtxt-fb328631e55830f3a2cab79bf18115324910c93c.tar.gz |
moved timed/periodic functions and types to periodic.go
Diffstat (limited to 'svc/init.go')
-rw-r--r-- | svc/init.go | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/svc/init.go b/svc/init.go index 71527cf..537119c 100644 --- a/svc/init.go +++ b/svc/init.go @@ -30,9 +30,12 @@ var confObj = &Configuration{} // Signals to close the log file var closeLog = make(chan bool, 1) -// Used to transmit database pointer, database ticker, -// and cache ticker after initialization +// Used to transmit database pointer var dbChan = make(chan dbase, 1) + +// Used to transmit the wrapped tickers +// corresponding to the in-memory cache +// or the on-disk database. var dbTickC = make(chan *tick, 1) var cTickC = make(chan *tick, 1) @@ -100,22 +103,6 @@ func checkFlags() { } } -// Starts the tickers that periodically: -// - pull new user statuses into cache -// - push cached data to disk -func initPersistence() { - confObj.Mu.RLock() - cacheTkr := initTicker(false, confObj.CacheInterval) - dbTkr := initTicker(true, confObj.DBInterval) - confObj.Mu.RUnlock() - - go dataTimer(cacheTkr) - go dataTimer(dbTkr) - - dbTickC <- dbTkr - cTickC <- cacheTkr -} - // Watch for SIGINT aka ^C // Close the log file then exit func watchForInterrupt() { |