mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
chore: make aggregation time configurable (resolve #60)
This commit is contained in:
parent
a4c344aaa1
commit
177cbb12fc
@ -7,6 +7,7 @@ server:
|
||||
|
||||
app:
|
||||
cleanup: false # only edit, if you know what you're doing
|
||||
aggregation_time: '02:15' # time at which to run daily aggregation batch jobs
|
||||
custom_languages:
|
||||
vue: Vue
|
||||
jsx: JSX
|
||||
|
@ -27,6 +27,7 @@ var (
|
||||
|
||||
type appConfig struct {
|
||||
CleanUp bool `default:"false" env:"WAKAPI_CLEANUP"`
|
||||
AggregationTime string `yaml:"aggregation_time" default:"02:15" env:"WAKAPI_AGGREGATION_TIME"`
|
||||
CustomLanguages map[string]string `yaml:"custom_languages"`
|
||||
LanguageColors map[string]string `yaml:"-"`
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ type AggregationJob struct {
|
||||
}
|
||||
|
||||
// Schedule a job to (re-)generate summaries every day shortly after midnight
|
||||
// TODO: Make configurable
|
||||
func (srv *AggregationService) Schedule() {
|
||||
jobs := make(chan *AggregationJob)
|
||||
summaries := make(chan *models.Summary)
|
||||
@ -58,7 +57,7 @@ func (srv *AggregationService) Schedule() {
|
||||
// Run once initially
|
||||
srv.trigger(jobs)
|
||||
|
||||
gocron.Every(1).Day().At("02:15").Do(srv.trigger, jobs)
|
||||
gocron.Every(1).Day().At(srv.Config.App.AggregationTime).Do(srv.trigger, jobs)
|
||||
<-gocron.Start()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user