timetable-extension #1
@ -2,6 +2,7 @@ package background
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"math"
|
"math"
|
||||||
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -18,8 +19,8 @@ const frequency = 2 * time.Hour // Figure out a sensible frequency!
|
|||||||
func InitTicker(cfg *helpers.Configuration, stop <-chan struct{}) {
|
func InitTicker(cfg *helpers.Configuration, stop <-chan struct{}) {
|
||||||
go runTicker(cfg, stop)
|
go runTicker(cfg, stop)
|
||||||
|
|
||||||
// Run goroutine logging ticker if runtime set to debug
|
// Run goroutine logging ticker if env "perflog" is set to "on"
|
||||||
if helpers.Runtime == "debug" {
|
if os.Getenv("perflog") == "on" {
|
||||||
go goroutineTicker(stop)
|
go goroutineTicker(stop)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -33,8 +34,10 @@ func runTicker(cfg *helpers.Configuration, stop <-chan struct{}) {
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-stop:
|
case <-stop:
|
||||||
|
log.Debug("Stopping background task ticker")
|
||||||
return
|
return
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
|
log.Debug("Running background tasks")
|
||||||
go cif.CheckCif(cfg)
|
go cif.CheckCif(cfg)
|
||||||
go corpus.CheckCorpus(cfg)
|
go corpus.CheckCorpus(cfg)
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ func CheckCif(cfg *helpers.Configuration) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Checking age of CIF Data")
|
log.Debug("Checking age of CIF Data")
|
||||||
|
|
||||||
// Load and read metadata from database
|
// Load and read metadata from database
|
||||||
metadata, err := dbAccess.GetCifMetadata()
|
metadata, err := dbAccess.GetCifMetadata()
|
||||||
|
Loading…
Reference in New Issue
Block a user