mirror of
https://github.com/simon-ding/polaris.git
synced 2026-02-06 15:10:49 +08:00
feat: add log and defer task loading
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user