mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 19:47:47 +08:00
feat: add dummy housekeeping tasks
This commit is contained in:
26
engine/housekeeping.go
Normal file
26
engine/housekeeping.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package engine
|
||||||
|
|
||||||
|
import "polaris/log"
|
||||||
|
|
||||||
|
func (c *Engine) housekeeping() error {
|
||||||
|
log.Infof("start housekeeping tasks...")
|
||||||
|
|
||||||
|
if err := c.checkDbScraps(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := c.checkImageFilesInterity(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Engine) checkDbScraps() error {
|
||||||
|
//TODO: remove episodes that are not associated with any series
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Engine) checkImageFilesInterity() error {
|
||||||
|
//TODO: download missing image files, remove unused image files
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -41,6 +41,7 @@ func (c *Engine) addSysCron() {
|
|||||||
})
|
})
|
||||||
c.registerCronJob("check_series_new_release", "0 0 */12 * * *", c.checkAllSeriesNewSeason)
|
c.registerCronJob("check_series_new_release", "0 0 */12 * * *", c.checkAllSeriesNewSeason)
|
||||||
c.registerCronJob("update_import_lists", "0 */20 * * * *", c.periodicallyUpdateImportlist)
|
c.registerCronJob("update_import_lists", "0 */20 * * * *", c.periodicallyUpdateImportlist)
|
||||||
|
c.registerCronJob("housekeeping", "0 0 * * * *", c.housekeeping)
|
||||||
|
|
||||||
c.schedulers.Range(func(key string, value scheduler) bool {
|
c.schedulers.Range(func(key string, value scheduler) bool {
|
||||||
log.Debugf("add cron job: %v", key)
|
log.Debugf("add cron job: %v", key)
|
||||||
|
|||||||
Reference in New Issue
Block a user