mirror of
https://github.com/kwinH/fastApi.git
synced 2025-12-24 13:07:58 +08:00
28 lines
393 B
Go
28 lines
393 B
Go
package crontab
|
|
|
|
import (
|
|
"context"
|
|
"fastApi/app/model"
|
|
"fastApi/core/global"
|
|
)
|
|
|
|
func init() {
|
|
CronList = append(CronList, testJob{})
|
|
}
|
|
|
|
type testJob struct {
|
|
}
|
|
|
|
func (j testJob) getSpec() string {
|
|
return "@every 3s"
|
|
}
|
|
|
|
func (j testJob) getName() string {
|
|
return "test1"
|
|
}
|
|
|
|
func (j testJob) Run(ctx context.Context) {
|
|
model.GetUser(1)
|
|
global.Log.Info("tick every 1 second run once")
|
|
}
|