Skip to content

simple asynchronous task generator tool writed by go

Notifications You must be signed in to change notification settings

goctopus/go-task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

go-task

simple asynchronous task generator tool writed by go

install

go get github.com/chenhg5/go-task

usage

import (
	"runtime"
	"fmt"
	"time"
	"github.com/chenhg5/go-task"
)

func main() {

	// init
	task.InitTaskReceiver(runtime.NumCPU())

	// add task: parameter, taskList, expiration
	task.AddTask(task.NewTask(
		map[string]interface{}{
            "paramA" : "value",
        },  // parameter
		[]task.FacFunc{func(uuid string, param map[string]interface{}) (string, error) {
			fmt.Println(uuid)
			fmt.Println(param)
			return "ok", nil
		}}, -1),
	)

	time.Sleep(time.Second * 5)
}

todo

  • get the number of statistical state
  • api for putting an end to a task
  • api for clearing task list
  • add task delay list

About

simple asynchronous task generator tool writed by go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages