Support variable parameters task send worker

go-worker-pool

Support variable parameters task send worker

调用方式

go get github.com/214200196/gwp/v1
import (
	"fmt"
	"github.com/214200196/gwp/v1"
	"time"
)

func main() {
	workPool := v1.NewWorkerPool(5)
	defer workPool.Dispatch()

	go func() {
		for i :=0; i < 50; i++ {
			f := func(s interface{}) error {
				fmt.Println("task func", s)
				time.Sleep(time.Second)
				// return errors.New("task func error")
				return nil
			}
			task := workPool.NewTask(f, i)
			if err := workPool.Submit(task); err != nil {
				fmt.Println(err)
				break
			}
		}
		// 退出
		workPool.Quit()
	}()
}
Similar Resources

Run vscode task in command line

vstask Run vscode task in command line install go install "github.com/ttttmr/vstask" usage NAME: vstask - Run vscode task in command line USAGE:

Jul 1, 2022

Prismforce-task - Assignment to test fundamental knowledge for Prism Force

Technical Assignment Assignment to test fundamental knowledge for Prism Force. T

Feb 15, 2022

Job queuing service and async task runner.

Valet Stateless Go server responsible for running tasks asynchronously and concurrently. Overview Job Pipeline Architecture Installation Configuration

Dec 22, 2022

A simple Go utility to display track information from, and send commands to, spotifyd from Tiling Window Managers like Sway and i3

A simple Go utility to display track information from, and send commands to, spotifyd from Tiling Window Managers like Sway and i3

Untitled Spotifyd Controller A simple Go utility to display track information from, and send commands to, spotifyd from Tiling Window Managers like Sw

Mar 8, 2022

Contact-api - API for websites I have designed that have to send unauthenticated email

contact https://aws.amazon.com/premiumsupport/knowledge-center/custom-headers-ap

Apr 11, 2022

Send IAM-signed requests to AppSync and API Gateway

golang-iam-requests Provides helpers to send IAM-signed requests to AWS AppSync and AWS API Gateway services Generates a v4 sign using IAM credentials

Apr 21, 2022

Send messages from slack incoming webhook integrations to telegram

Send messages from slack incoming webhook integrations to telegram

slack-to-telegram Slack incoming webhook to telegram Send messages from slack incoming webhook integrations to telegram Tested on Gitlab Slack Notific

Jul 19, 2022

This is a Golang wrapper for working with TMDb API. It aims to support version 3.

This is a Golang wrapper for working with TMDb API. It aims to support version 3.

This is a Golang wrapper for working with TMDb API. It aims to support version 3. An API Key is required. To register for one, head over to themoviedb

Dec 27, 2022

Support for Usagi API developed by @DanielaGC. The library is written in Go Lang

📦 Usagi API - Wrapper This library is simple and easy to use and was developed entirely for Usagi API written in Go Lang. 👨‍🏫 Example package main

Oct 18, 2021
My Simple Instagram-Clone API task submission, conducted by Appointy for internship shortlisting.

go-pointy Go-Pointy is a simple Instagram API Clone, made using GoLang. I had tried my best to not be lazy and finish the tasks, as a beginner to the

Jul 25, 2022
The task given by Appointy completed to develop APIs for a basic version of Instagram.

✨ Instagram APIs ✨ The task given by Appointy completed to develop APIs for a basic version of Instagram. Create an User Get User by Id Create a Post

Oct 9, 2021
The task is to develop a basic version of a Instagram.
The task is to develop a basic version of a Instagram.

Golang-api-task Developer: Mukka Deepak The task is to develop a basic version of aInstagram. You are only required to develop the API for the system.

Oct 23, 2021
Instagram clone as Appointy task
Instagram clone as Appointy task

Instagram Backend Clone Task for Appointy Internship 2021 Explore the docs » View Demo · Report Bug · Request Feature Table of Contents About the Proj

Oct 11, 2021
ABAG - Go Task

ABAG - Go Task Problem Statement Jimmy owns a garden in which he has planted N trees in a row. After a few years, the trees have grown up and now they

Jul 30, 2022
Recruitment task.

Clients-emails project. Description. Microservice that stores clients and send them emails based on mailing ID. The service uses Go and PostgreSQL. Bo

Nov 24, 2021
A Google interview task my friend told me about.

deriving π given a normal distribution Try it yourself: package main import ( "fmt" "github.com/cpmech/gosl/rnd" ) // normal returns a number acc

Dec 16, 2021
Stq - Simple Task Queue with REST API

stq Simple Tasks Queue with HTTP API Environments list: Variable Value BACKEND m

Jan 5, 2022
ABAG - The implementation for the alternating trees problem specified in the task

ABAG - GO task This repo contains the implementation for the alternating trees p

Jan 6, 2022
MealPlanr is an application dedicated to the trivial and boring task of meal planning 📅 and generating a shopping list 🛒 .
MealPlanr is an application dedicated to the trivial and boring task of meal planning 📅 and generating a shopping list 🛒 .

MealPlanr is an application dedicated to the trivial and boring task of meal planning ?? and generating a shopping list ?? .

Mar 1, 2022