taskService

package
v0.0.0-...-fdfd418 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const HttpExecTimeout = 300

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

Variables

This section is empty.

Functions

func SendNotification

func SendNotification(task taskModel.Task, taskResult TaskResult)

发送任务结果通知

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 HTTPHandler

type HTTPHandler struct{}

HTTP任务

func (*HTTPHandler) Run

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

type Handler

type Handler interface {
	Run(taskModel taskModel.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 taskModel.Task, taskUniqueId int64) (result string, err error)

type Task

type Task struct{}
var (
	ServiceTask Task
)

func (Task) Add

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

添加任务

func (Task) BatchAdd

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

批量添加任务

func (Task) Initialize

func (task Task) Initialize()

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

func (Task) NextRunTime

func (task Task) NextRunTime(taskModels taskModel.Task) string

func (Task) Remove

func (task Task) Remove(taskId int)

func (Task) RemoveAndAdd

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

删除任务后添加

func (Task) RemoveAndStop

func (task Task) RemoveAndStop(taskId int)

删除任务后添加

func (Task) Run

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

直接运行任务

func (Task) Stop

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

停止运行中的任务

func (Task) StopJob

func (task Task) StopJob()

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