Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DebugMode = false
View Source
var DefaultWriter io.Writer = os.Stdout
View Source
var MAX_POOL_CAPITION uint32 = 10000
*
*@author wxn *@project ConcurrencyCron *@package ConcurrencyCron *@date 19-8-2 上午10:02
Functions ¶
func SetMaxConcurrent ¶
Set the maximum number of concurrent
Types ¶
type Scheduler ¶
type Scheduler interface { Every(interval uint64) TasksPool Once() TasksPool Start(ctx context.Context) Stop() RemoveByUuid(uuid string) GetCurrentTicketsNum() uint32 GetTaskNum() int ListTasks() interface{} }
func NewScheduler ¶
type TasksPool ¶
type TasksPool interface { At(tm string) *task //Run at some times Seconds() *task //Run every few seconds Minutes() *task //Run every few minutes Hours() *task //Run every few hours Days() *task //Run every few days Weekdays() *task //Run every few weeks Monday() *task //Run every few weeks on Monday Tuesday() *task //Run every few weeks on Tuesday Wednesday() *task //Run every few weeks on Wednesday Thursday() *task //Run every few weeks on Thursday Friday() *task //Run every few weeks on Friday Saturday() *task //Run every few weeks on Saturday Sunday() *task //Run every few weeks on Sunday JudgeRun(tm time.Time) bool //Determine if it is going to run Run(ticket TicketsPool, tm time.Time) //Run and judge the next run time GetNext() time.Time //Get nest run time Do(taskFunc interface{}, params ...interface{}) string //Add a run function GetUuid() string //get uuid Done() bool //get once job done Once() bool GetFunInfo() string }
*
*@author wxn *@project ConcurrencyCron *@package ConcurrencyCron *@date 19-8-2 上午11:23
func NewOnceTask ¶
type TicketsPool ¶
type TicketsPool interface { //take a ticket Take() //return a ticket Return() //get the ticket pools' status Active() bool //total tickets Total() uint32 //remain tickets Remain() uint32 //close pool Close() }
Control the number of concurrent ticket pools
Click to show internal directories.
Click to hide internal directories.