Skip to content

复合条件hang住 #25

Open
Open
@feeops

Description

示例代码

package main

import (
	"fmt"
	"time"

	"github.com/devchat-ai/gopool"
)

func main() {
	pool := gopool.NewGoPool(10, gopool.WithErrorCallback(func(err error) {
		fmt.Println("Task error:", err)
	}), gopool.WithTimeout(6*time.Second))
	defer pool.Release()

	for i := 0; i < 20; i++ {
		pool.AddTask(func() (interface{}, error) {
			i := i
			fmt.Println(i)
			time.Sleep(time.Duration(i) * time.Second)
			return nil, nil
		})
	}
	pool.Wait()
}

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions