@cyanheads/pubmed-mcp-server
Version:
Search PubMed/Europe PMC, fetch articles and full text (PMC/EPMC/Unpaywall), citations, MeSH terms via MCP. STDIO or Streamable HTTP.
33 lines • 1.45 kB
TypeScript
/**
* @fileoverview Rate-limited request scheduler for Europe PMC calls. Caps
* concurrent in-flight requests and enforces a minimum start-gap between
* dispatches to stay polite with EBI's infrastructure. Independent rate
* domain from NCBI's queue — Europe PMC runs on a different host with its
* own limits.
* @module src/services/europe-pmc/request-queue
*/
/**
* Schedules Europe PMC requests against two independent ceilings:
*
* - **Throughput** (`minStartGapMs`): minimum delay between two consecutive
* dispatch times. Defaults to 200ms to be polite with EBI.
* - **Concurrency** (`maxConcurrent`): maximum simultaneous in-flight
* requests. Decouples concurrency from rate so slow upstream responses
* don't block new dispatches.
*
* Enqueue accepts an optional `AbortSignal` so callers can bound their total
* time inside the scheduler — when the signal fires, a still-waiting task
* rejects immediately instead of sitting behind a saturated worker.
*/
export declare class EuropePmcRequestQueue {
private readonly waiters;
private readonly minStartGapMs;
private readonly maxConcurrent;
private inFlight;
private lastStartTime;
private nextDispatchTimer;
constructor(minStartGapMs: number, maxConcurrent?: number);
enqueue<T>(task: () => Promise<T>, label: string, signal?: AbortSignal): Promise<T>;
private tryDispatch;
}
//# sourceMappingURL=request-queue.d.ts.map