summaryrefslogtreecommitdiffstats
path: root/services/cron/tasks.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/cron/tasks.go')
-rw-r--r--services/cron/tasks.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/services/cron/tasks.go b/services/cron/tasks.go
index 732eead930..75bb4993c0 100644
--- a/services/cron/tasks.go
+++ b/services/cron/tasks.go
@@ -10,9 +10,9 @@ import (
"reflect"
"sync"
- "code.gitea.io/gitea/models"
admin_model "code.gitea.io/gitea/models/admin"
"code.gitea.io/gitea/models/db"
+ user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/graceful"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/process"
@@ -29,7 +29,7 @@ type Task struct {
lock sync.Mutex
Name string
config Config
- fun func(context.Context, *models.User, Config) error
+ fun func(context.Context, *user_model.User, Config) error
ExecTimes int64
}
@@ -55,7 +55,7 @@ func (t *Task) GetConfig() Config {
// Run will run the task incrementing the cron counter with no user defined
func (t *Task) Run() {
- t.RunWithUser(&models.User{
+ t.RunWithUser(&user_model.User{
ID: -1,
Name: "(Cron)",
LowerName: "(cron)",
@@ -63,7 +63,7 @@ func (t *Task) Run() {
}
// RunWithUser will run the task incrementing the cron counter at the time with User
-func (t *Task) RunWithUser(doer *models.User, config Config) {
+func (t *Task) RunWithUser(doer *user_model.User, config Config) {
if !taskStatusTable.StartIfNotRunning(t.Name) {
return
}
@@ -118,7 +118,7 @@ func GetTask(name string) *Task {
}
// RegisterTask allows a task to be registered with the cron service
-func RegisterTask(name string, config Config, fun func(context.Context, *models.User, Config) error) error {
+func RegisterTask(name string, config Config, fun func(context.Context, *user_model.User, Config) error) error {
log.Debug("Registering task: %s", name)
_, err := setting.GetCronSettings(name, config)
if err != nil {
@@ -163,7 +163,7 @@ func RegisterTask(name string, config Config, fun func(context.Context, *models.
}
// RegisterTaskFatal will register a task but if there is an error log.Fatal
-func RegisterTaskFatal(name string, config Config, fun func(context.Context, *models.User, Config) error) {
+func RegisterTaskFatal(name string, config Config, fun func(context.Context, *user_model.User, Config) error) {
if err := RegisterTask(name, config, fun); err != nil {
log.Fatal("Unable to register cron task %s Error: %v", name, err)
}