Skip to content

Instantly share code, notes, and snippets.

@oleh-zaporozhets
Created October 23, 2021 18:45
Show Gist options
  • Select an option

  • Save oleh-zaporozhets/77f66055022a2c97fc222ce035ac00a5 to your computer and use it in GitHub Desktop.

Select an option

Save oleh-zaporozhets/77f66055022a2c97fc222ce035ac00a5 to your computer and use it in GitHub Desktop.
class CircuitBreaker implements ICircuitBreaker {
private readonly http: IHttp;
private readonly timeout: number;
private isOpen = false;
private errorHandler: (error: any) => boolean;
constructor(http: IHttp, options: ICircuitBreakerOptions) {
this.http = http;
this.timeout = options.timeout;
this.errorHandler = options.errorHandler;
}
public getStatus() {
return this.isOpen;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment