Skip to content

⚡ support massive scheduled tasks in short time, high performance

Notifications You must be signed in to change notification settings

pzs-pzs/timingwheel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Time Wheel

support massive scheduled tasks in short time, high performance

Install

go get -u github.com/pzs-pzs/timingwheel

Example

package main

import (
	"github.com/pzs-pzs/timingwheel"
	"time"
)

func main() {
	tw, err := timingwheel.NewTimingWheel(1*time.Second, 10)
	if err != nil {
		panic(err)
	}
	beginTime := time.Now().Unix()
	err = tw.AddOnceTask(5*time.Second, "taskId", false, func(key string) {
		println(key)
		endTime := time.Now().Unix()
		println(endTime - beginTime)
	})
	if err != nil {
		panic(err)
	}
	tw.Start()
	time.Sleep(20 * time.Second)
	tw.Stop()

}

About

⚡ support massive scheduled tasks in short time, high performance

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published