Created
October 23, 2021 18:47
-
-
Save oleh-zaporozhets/49ea07a87d31dedbc4165bba2ebab096 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| private interceptErrorResponse(error: any) { | |
| const shouldCircuitBreakerBeOpen = this.errorHandler(error); | |
| if (shouldCircuitBreakerBeOpen && !this.isOpen) { | |
| this.openCircuitBreaker(); | |
| } | |
| return Promise.reject(error); | |
| } | |
| private openCircuitBreaker() { | |
| this.isOpen = true; | |
| setTimeout(() => { | |
| this.isOpen = false; | |
| }, this.timeout); | |
| } | |
| ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment