Skip to content

Commit

Permalink
fix: add missing memory circuit breaker options
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Da Silva <mail@robdasilva.com>
  • Loading branch information
robdasilva committed Jul 21, 2022
1 parent ca12492 commit a62e420
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 2 additions & 4 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import Transport, {
RequestBody,
RequestNDBody,
Context,
MemoryCircuitBreakerOptions,
} from './lib/Transport';
import { URL } from 'url';
import Connection, { AgentOptions, agentFn } from './lib/Connection';
Expand Down Expand Up @@ -137,10 +138,7 @@ interface ClientOptions {
password?: string;
};
disablePrototypePoisoningProtection?: boolean | 'proto' | 'constructor';
memoryCircuitBreaker?: {
enabled: boolean;
maxPercentage: number;
};
memoryCircuitBreaker?: MemoryCircuitBreakerOptions
}

declare class Client {
Expand Down
7 changes: 7 additions & 0 deletions lib/Transport.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ export interface generateRequestIdFn {
(params: TransportRequestParams, options: TransportRequestOptions): any;
}

export interface MemoryCircuitBreakerOptions {
enabled: boolean;
maxPercentage: number;
}

interface TransportOptions {
emit: (event: string | symbol, ...args: any[]) => boolean;
connectionPool: ConnectionPool | CloudConnectionPool;
Expand All @@ -77,6 +82,7 @@ interface TransportOptions {
generateRequestId?: generateRequestIdFn;
name?: string;
opaqueIdPrefix?: string;
memoryCircuitBreaker: MemoryCircuitBreakerOptions;
}

export interface RequestEvent<TResponse = Record<string, any>, TContext = Context> {
Expand Down Expand Up @@ -172,6 +178,7 @@ export default class Transport {
sniffInterval: number;
sniffOnConnectionFault: boolean;
opaqueIdPrefix: string | null;
memoryCircuitBreaker: MemoryCircuitBreakerOptions;
sniffEndpoint: string;
_sniffEnabled: boolean;
_nextSniff: number;
Expand Down

0 comments on commit a62e420

Please sign in to comment.