Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

package main

import (
	"fmt"
	"github.com/cha0ran/bucket"
	"sync"
	"time"
)

func main() {
	var wg sync.WaitGroup
	b := bucket.NewBucket(time.Minute, 60, 1, false)
	defer b.Close()

	for i := 0; i < 100; i++ {
		wg.Add(1)
		go func(taskId int) {
			defer wg.Done()
			b.Take()
			fmt.Printf("Task number: %d", taskId)
		}(i)
	}

	wg.Wait()
}

About

A simple token bucket.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages