scouting: Make background_task interval configurable
This patch modifies the API so that the background task gets invoked
at a user-defined interval. There are no functional changes since we
schedule everything at 10 minute intervals. That matches the previous
behaviour.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I512ddcd01408f9d1af706ca390c84368f6816638
diff --git a/scouting/webserver/main.go b/scouting/webserver/main.go
index ba9d120..c5bed2c 100644
--- a/scouting/webserver/main.go
+++ b/scouting/webserver/main.go
@@ -141,17 +141,17 @@
// Since Go doesn't support default arguments, we use 0 and "" to
// indicate that we want to source the values from the config.
- matchListScraper := background_task.BackgroundTask{}
+ matchListScraper := background_task.New(10 * time.Minute)
matchListScraper.Start(func() {
match_list.GetMatchList(database, 0, "", *blueAllianceConfigPtr)
})
- rankingsScraper := background_task.BackgroundTask{}
+ rankingsScraper := background_task.New(10 * time.Minute)
rankingsScraper.Start(func() {
rankings.GetRankings(database, 0, "", *blueAllianceConfigPtr)
})
- driverRankingParser := background_task.BackgroundTask{}
+ driverRankingParser := background_task.New(10 * time.Minute)
driverRankingParser.Start(func() {
// Specify "" as the script path here so that the default is
// used.