feat: add log and defer task loading

This commit is contained in:
Simon Ding
2024-11-04 12:04:28 +08:00
parent 1e2d8b8520
commit b176253fc4
3 changed files with 4 additions and 1 deletions

View File

@@ -44,7 +44,7 @@ func (c *Client) registerCronJob(name string, cron string, f func() error) {
}
func (c *Client) Init() {
c.reloadTasks()
go c.reloadTasks()
c.addSysCron()
}
@@ -82,6 +82,7 @@ func (c *Client) reloadTasks() {
}
}
log.Infof("------ task reloading done ------")
}
func (c *Client) GetDownloadClient() (pkg.Downloader, *ent.DownloadClients, error) {

View File

@@ -36,6 +36,7 @@ func (c *Client) addSysCron() {
return true
})
c.cron.Start()
log.Infof("--------- add cron jobs done --------")
}
func (c *Client) mustAddCron(spec string, cmd func()) {

View File

@@ -132,6 +132,7 @@ func (s *Server) Serve() error {
importlist.POST("/add", HttpHandler(s.addImportlist))
importlist.DELETE("/delete", HttpHandler(s.deleteImportList))
}
log.Infof("----------- Polaris Server Successfully Started ------------")
return s.r.Run(":8080")
}