Skip to content

go-scheduler - Golang package providing function for executing task periodically.

License

Notifications You must be signed in to change notification settings

jtaczanowski/go-scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goscheduler Build Status Coverage Status Go Report Card

goscheduler - Golang package providing function for executing task periodically. Optionaly you can add delay on task start.

Example usage (also included in example catalog)

package main

import (
	"fmt"
	"time"

	"github.com/jtaczanowski/go-scheduler"
)

func main() {
	// run function exampleTask() every 10s
	scheduler.RunTaskAtInterval(exampleTask, time.Second*10, time.Second*0)

	// run function exampleTask() every 10s, but delay on start by 3 second
	scheduler.RunTaskAtInterval(exampleTask, time.Second*10, time.Second*3)

	// run function exampleTaskWithArguments("example task with arguments") every 10s
	scheduler.RunTaskAtInterval(
		func() { exampleTaskWithArguments("example task with arguments") },
		time.Second*10,
		time.Second*0,
	)
}

func exampleTask() {
	fmt.Print("example")
}

func exampleTaskWithArguments(str string) {
	fmt.Print(str)
}

About

go-scheduler - Golang package providing function for executing task periodically.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages