$120 tested Claude codes · real before/after data · Full tier $15 one-timebuy --sheet=15 →
$Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. download --free →
clskills.sh — terminal v2.4 — 2,347 skills indexed● online
[CL]Skills_
Networkingintermediate

Request Queue

Share

Queue and batch HTTP requests

Works with OpenClaude

You are a backend engineer implementing an HTTP request queue system. The user wants to queue and batch HTTP requests efficiently with configurable concurrency and retry logic.

What to check first

  • Verify you have a Node.js HTTP client installed: npm list axios or npm list node-fetch
  • Check your target concurrency limit (how many simultaneous requests you can handle)

Steps

  1. Create a queue class that stores pending requests with metadata (URL, method, payload, priority)
  2. Implement a worker pool that processes requests up to a max concurrency limit
  3. Add batch grouping logic to combine multiple requests into single payloads when beneficial
  4. Implement exponential backoff retry mechanism with jitter for failed requests
  5. Use async/await with Promise.all() to handle concurrent request execution within limits
  6. Track request state (pending, in-progress, completed, failed) and expose queue status
  7. Add a flush method to force immediate processing of all queued items
  8. Emit events or callbacks when requests complete or fail for observability

Code

const EventEmitter = require('events');
const axios = require('axios');

class RequestQueue extends EventEmitter {
  constructor(options = {}) {
    super();
    this.maxConcurrency = options.maxConcurrency || 3;
    this.maxRetries = options.maxRetries || 3;
    this.batchSize = options.batchSize || null;
    this.batchDelay = options.batchDelay || 100;
    this.queue = [];
    this.inProgress = 0;
    this.batchTimer = null;
  }

  add(request) {
    const task = {
      id: Math.random().toString(36),
      url: request.url,
      method: request.method || 'GET',
      data: request.data || null,
      headers: request.headers || {},
      priority: request.priority || 0,
      retries: 0,
      timestamp: Date.now(),
    };
    
    this.queue.push(task);
    this.queue.sort((a, b) => b.priority - a.priority);
    
    if (this.batchSize) {
      clearTimeout(this.batchTimer);
      if (this.queue.length >= this.batchSize) {
        this.process();
      } else {
        this.batchTimer = setTimeout(() => this.process(), this.batchDelay);
      }
    } else {
      this.process();
    }
    
    return task.id;
  }

  async process() {
    while (this.queue.length > 0 && this.inProgress < this.maxConcurrency) {
      const task = this.queue.shift();
      this.inProgress++;
      this.executeTask(task);
    }
  }

  async executeTask(task) {
    try {
      const response = await axios({
        method

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

CategoryNetworking
Difficultyintermediate
Version1.0.0
AuthorClaude Skills Hub
networkingqueuebatching

Install command:

curl -o ~/.claude/skills/request-queue.md https://claude-skills-hub.vercel.app/skills/networking/request-queue.md

Related Networking Skills

Other Claude Code skills in the same category — free to download.

Want a Networking skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.