Merge branch 'periodicRefresh' into 'master'
Add a config to set the info refresh interval See merge request !83
This commit is contained in:
commit
a14bccf75c
@ -7,6 +7,7 @@ listen_port: 3000
|
||||
public_dir: build/public
|
||||
# default prefix, will be served by the go http server
|
||||
img_url_prefix: img/
|
||||
periodic_refresh: 12h
|
||||
|
||||
movie:
|
||||
detailers:
|
||||
|
@ -13,11 +13,12 @@ import (
|
||||
|
||||
// Config represents the Config of the canape app
|
||||
type Config struct {
|
||||
Authorizer AuthorizerConfig `yaml:"authorizer"`
|
||||
PGDSN string `yaml:"pgdsn"`
|
||||
Port string `yaml:"listen_port"`
|
||||
PublicDir string `yaml:"public_dir"`
|
||||
ImgURLPrefix string `yaml:"img_url_prefix"`
|
||||
Authorizer AuthorizerConfig `yaml:"authorizer"`
|
||||
PGDSN string `yaml:"pgdsn"`
|
||||
Port string `yaml:"listen_port"`
|
||||
PublicDir string `yaml:"public_dir"`
|
||||
ImgURLPrefix string `yaml:"img_url_prefix"`
|
||||
PeriodicRefresh string `yaml:"periodic_refresh"`
|
||||
|
||||
MovieExplorers []polochon.Explorer
|
||||
MovieDetailers []polochon.Detailer
|
||||
|
@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
@ -73,7 +74,8 @@ func main() {
|
||||
c := cron.New()
|
||||
|
||||
// Refresh the library every 6h
|
||||
c.AddFunc("@every 6h", func() {
|
||||
env.Log.Debugf("Running refresh cron every %s", cf.PeriodicRefresh)
|
||||
c.AddFunc(fmt.Sprintf("@every %s", cf.PeriodicRefresh), func() {
|
||||
env.Log.Infof("Running refresh cron!")
|
||||
extmedias.Refresh(env)
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user