service

package
v0.0.0-...-000f062 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const HttpExecTimeout = 300

http任务执行时间不超过300秒

Variables

This section is empty.

Functions

func ExecDb

func ExecDb(ip string, port int64, taskReq *utils.DbTaskRequest) (string, error)

func SendNotification

func SendNotification(taskModel models.Task, taskResult TaskResult)

发送任务结果通知

func Stop

func Stop(ip string, port int64, id int64)

Types

type ConcurrencyQueue

type ConcurrencyQueue struct {
	// contains filtered or unexported fields
}

并发队列

func (*ConcurrencyQueue) Add

func (cq *ConcurrencyQueue) Add()

func (*ConcurrencyQueue) Done

func (cq *ConcurrencyQueue) Done()

type DataBaseHandler

type DataBaseHandler struct{}

database调用执行任务

func (*DataBaseHandler) Run

func (h *DataBaseHandler) Run(taskModel models.Task, taskUniqueId int64) (result string, err error)

type HTTPHandler

type HTTPHandler struct{}

HTTP任务

func (*HTTPHandler) Run

func (h *HTTPHandler) Run(taskModel models.Task, taskUniqueId int64) (result string, err error)

type Handler

type Handler interface {
	Run(taskModel models.Task, taskUniqueId int64) (string, error)
}

type Instance

type Instance struct {
	// contains filtered or unexported fields
}

任务ID作为Key

type RPCHandler

type RPCHandler struct{}

RPC调用执行任务

func (*RPCHandler) Run

func (h *RPCHandler) Run(taskModel models.Task, taskUniqueId int64) (result string, err error)

type Server

type Server struct{}

func (Server) DbRun

func (Server) Run

func (s Server) Run(ctx context.Context, req *pb.TaskRequest) (*pb.TaskResponse, error)

type Task

type Task struct{}
var (
	ServiceTask Task
)

func (Task) Add

func (task Task) Add(taskModel models.Task)

添加任务

func (Task) BatchAdd

func (task Task) BatchAdd(tasks []models.Task)

批量添加任务

func (Task) Initialize

func (task Task) Initialize()

初始化任务, 从数据库取出所有任务, 添加到定时任务并运行

func (Task) NextRunTime

func (task Task) NextRunTime(taskModel models.Task) time.Time

func (Task) NextRunTimeWeb

func (task Task) NextRunTimeWeb(taskModel models.Rtask) time.Time

func (Task) Remove

func (task Task) Remove(id int)

func (Task) RemoveAndAdd

func (task Task) RemoveAndAdd(taskModel models.Task)

删除任务后添加

func (Task) Run

func (task Task) Run(taskModel models.Task)

直接运行任务

func (Task) Stop

func (task Task) Stop(ip string, port int64, id int64)

停止运行中的任务

func (Task) WaitAndExit

func (task Task) WaitAndExit()

等待所有任务结束后退出

type TaskCount

type TaskCount struct {
	// contains filtered or unexported fields
}

任务计数

func (*TaskCount) Add

func (tc *TaskCount) Add()

func (*TaskCount) Done

func (tc *TaskCount) Done()

func (*TaskCount) Exit

func (tc *TaskCount) Exit()

func (*TaskCount) Wait

func (tc *TaskCount) Wait()

type TaskResult

type TaskResult struct {
	Result     string
	Err        error
	RetryTimes int8
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL