mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-26 02:34:58 +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() {
|
func (c *Client) Init() {
|
||||||
c.reloadTasks()
|
go c.reloadTasks()
|
||||||
c.addSysCron()
|
c.addSysCron()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,6 +82,7 @@ func (c *Client) reloadTasks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
log.Infof("------ task reloading done ------")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetDownloadClient() (pkg.Downloader, *ent.DownloadClients, error) {
|
func (c *Client) GetDownloadClient() (pkg.Downloader, *ent.DownloadClients, error) {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ func (c *Client) addSysCron() {
|
|||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
c.cron.Start()
|
c.cron.Start()
|
||||||
|
log.Infof("--------- add cron jobs done --------")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) mustAddCron(spec string, cmd func()) {
|
func (c *Client) mustAddCron(spec string, cmd func()) {
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ func (s *Server) Serve() error {
|
|||||||
importlist.POST("/add", HttpHandler(s.addImportlist))
|
importlist.POST("/add", HttpHandler(s.addImportlist))
|
||||||
importlist.DELETE("/delete", HttpHandler(s.deleteImportList))
|
importlist.DELETE("/delete", HttpHandler(s.deleteImportList))
|
||||||
}
|
}
|
||||||
|
log.Infof("----------- Polaris Server Successfully Started ------------")
|
||||||
|
|
||||||
return s.r.Run(":8080")
|
return s.r.Run(":8080")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user