export type Settled<R> =
| { status: 'fulfilled'; value: R }
| { status: 'rejected'; reason: unknown };
export interface ConcurrencyOptions {
limit: number;
import { Injectable } from '@nestjs/common';
export interface RateLimitResult {
allowed: boolean;
remaining: number;
limit: number;
package workpool
import (
"context"
"sync"
)
require "sidekiq/api"
class QueueDepthGuard
class QueueSaturated < StandardError
attr_reader :queue, :depth
import { Writable } from "node:stream";
import type { Pool } from "pg";
interface Row {
email: string;
name: string;
package com.example.orders;
public final class Order {
public static final Order POISON_PILL = new Order(-1L, 0.0);
use std::sync::mpsc::{self, SyncSender};
use std::sync::{Arc, Mutex};
use std::thread;
mod worker;
use worker::{Message, Worker};
class TokenBucket {
constructor(capacity, refillPerSecond) {
this.capacity = capacity;
this.refillPerMs = refillPerSecond / 1000;
this.tokens = capacity;
this.lastRefill = Date.now();
use std::sync::Arc;
use std::time::{Duration, Instant};
use tokio::sync::Mutex;
use tokio::time::sleep;
#[derive(Debug)]
use std::collections::HashSet;
use std::hash::Hash;
pub struct DedupByKey<I, K, F> {
inner: I,
key_fn: F,
package feed
import "time"
type Event struct {
ID string `json:"id"`
use async_trait::async_trait;
use std::io;
#[async_trait]
pub trait ConnectionFactory: Send + Sync + 'static {
type Connection: Send + 'static;