worker-pool

typescript
export type Settled<R> =
  | { status: 'fulfilled'; value: R }
  | { status: 'rejected'; reason: unknown };

export interface ConcurrencyOptions {
  limit: number;

Simple concurrency limiter for batch operations

node concurrency async
by codesnips 2 tabs
go
package workpool

import (
	"context"
	"sync"
)

Bounded Worker Pool Processing Jobs from a Buffered Channel in Go

go concurrency worker-pool
by codesnips 3 tabs
go
package pipeline

import "context"

func generate(ctx context.Context, nums ...int) <-chan int {
	out := make(chan int)

Fan-Out/Fan-In Pipeline With Channels and Context Cancellation in Go

go concurrency channels
by codesnips 3 tabs
go
package pool

import "context"

type Job func(ctx context.Context) error

Bounded worker pool with backpressure

go concurrency worker-pool
by Leah Thompson 1 tab
go
package worker

import "context"

func (p *Pool) Submit(job Job) error {
	// Reject fast if draining, otherwise enqueue with backpressure.

Graceful Drain of In-Flight Jobs Before Worker Shutdown in Go

go graceful-shutdown concurrency
by codesnips 3 tabs
go
package limiter

import (
	"context"
	"errors"
)

Leaky-Bucket Concurrency Limiter with a Buffered Semaphore Channel in Go

go concurrency rate-limiting
by codesnips 3 tabs
typescript
import { EventEmitter } from "events";

export interface Job<T> {
  id: string;
  payload: T;
  attempts: number;

Typed In-Memory Job Queue With a Concurrency-Limited Worker Pool

typescript job-queue concurrency
by codesnips 3 tabs
python
import queue
import time
from dataclasses import dataclass, field, replace
from typing import Any, Dict, Tuple

In-Process Threaded Background Job Queue for Sending Emails Without Redis

background-jobs threading queue
by codesnips 4 tabs
go
package fetch

import (
	"context"
	"net/http"

Bounded Fan-Out With Worker Pool, errgroup, and Result Collection in Go

go concurrency goroutines
by codesnips 3 tabs