mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 14:08:06 +08:00
feat: 增加应用商店定时同步 (#1231)
This commit is contained in:
parent
6919ce7b5c
commit
3ad3b180af
@ -39,6 +39,9 @@ func Run() {
|
|||||||
if _, err := global.Cron.AddJob("@daily", job.NewSSLJob()); err != nil {
|
if _, err := global.Cron.AddJob("@daily", job.NewSSLJob()); err != nil {
|
||||||
global.LOG.Errorf("can not add ssl corn job: %s", err.Error())
|
global.LOG.Errorf("can not add ssl corn job: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
if _, err := global.Cron.AddJob("@daily", job.NewAppStoreJob()); err != nil {
|
||||||
|
global.LOG.Errorf("can not add appstore corn job: %s", err.Error())
|
||||||
|
}
|
||||||
global.Cron.Start()
|
global.Cron.Start()
|
||||||
|
|
||||||
var cronJobs []model.Cronjob
|
var cronJobs []model.Cronjob
|
||||||
|
20
backend/cron/job/app.go
Normal file
20
backend/cron/job/app.go
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package job
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/1Panel-dev/1Panel/backend/app/service"
|
||||||
|
"github.com/1Panel-dev/1Panel/backend/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type app struct{}
|
||||||
|
|
||||||
|
func NewAppStoreJob() *app {
|
||||||
|
return &app{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *app) Run() {
|
||||||
|
global.LOG.Info("AppStore scheduled task in progress ...")
|
||||||
|
if err := service.NewIAppService().SyncAppListFromRemote(); err != nil {
|
||||||
|
global.LOG.Errorf("AppStore sync failed %s", err.Error())
|
||||||
|
}
|
||||||
|
global.LOG.Info("AppStore scheduled task has completed")
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user