Break out usage reporting into a service

This commit is contained in:
Jakob Borg
2015-05-12 09:35:37 +02:00
parent 83ea8dc577
commit c6b2ca8b19
3 changed files with 66 additions and 31 deletions

View File

@@ -677,16 +677,13 @@ func syncthingMain() {
cfg.SetOptions(opts)
cfg.Save()
}
go usageReportingLoop(m)
go func() {
time.Sleep(10 * time.Minute)
err := sendUsageReport(m)
if err != nil {
l.Infoln("Usage report:", err)
}
}()
}
// The usageReportingManager registers itself to listen to configuration
// changes, and there's nothing more we need to tell it from the outside.
// Hence we don't keep the returned pointer.
newUsageReportingManager(m, cfg)
if opts.RestartOnWakeup {
go standbyMonitor()
}