Skip to content

Latest commit

 

History

History
27 lines (19 loc) · 810 Bytes

README.md

File metadata and controls

27 lines (19 loc) · 810 Bytes

Description

Runner that spawns new goroutines to call a function. The goroutines run endlessly until the stop function is called. The number of goroutines to be created is required along with the functionality that each routine will execute. Also, an interval between each execution must be defined.

Documentation

Usage

To start the job-runner just define the callback function to be executed in every process.

callback := func() error {
		fmt.Println("executed")
		return nil
	}

count := 2 // the number of processes that run simultaneously
interval := 3*time.Second // the time to wait for a process to be executed
runner := runner.New(count, interval, callback)
runner.Start()

You can stop the job-runner with:

runner.Stop()