gocron

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 3 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

simple-cron

Library to run func by cron. Also to limit func runtime. Written in Golang

usage example
var myfunc = func() {
	// func example
	time.Sleep(time.Second * 10)
}

isTimeIsUP := simplecron.NewRuntimeLimitHandler(
	time.Second * 2,
	myfunc,
).Run()
if isTimeIsUP {
	// handle timeout
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CronObject

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

func NewCronHandler

func NewCronHandler(callback func(), timerTime time.Duration) *CronObject

func (*CronObject) IsActive

func (c *CronObject) IsActive() bool

func (*CronObject) IsPaused

func (c *CronObject) IsPaused() bool

func (*CronObject) Pause

func (c *CronObject) Pause()

func (*CronObject) Resume

func (c *CronObject) Resume()

func (*CronObject) Run

func (c *CronObject) Run(immediately ...bool)

func (*CronObject) Stop

func (c *CronObject) Stop()

type RunTimeLimitHandler

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

RunTimeLimitHandler - func runtime limit handler

func NewRuntimeLimitHandler

func NewRuntimeLimitHandler(timeout time.Duration, runFunc func()) *RunTimeLimitHandler

NewRuntimeLimitHandler - create new func runtime limit handler

func (*RunTimeLimitHandler) Run

func (r *RunTimeLimitHandler) Run() bool

Run - run func & limit runtime. returns: bool: true if time is up

Jump to

Keyboard shortcuts

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