本文整理汇总了TypeScript中opossum.CircuitBreaker.disable方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CircuitBreaker.disable方法的具体用法?TypeScript CircuitBreaker.disable怎么用?TypeScript CircuitBreaker.disable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opossum.CircuitBreaker
的用法示例。
在下文中一共展示了CircuitBreaker.disable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const shouldBeVoid2 = (): void => testWithOptions.disable();
示例2: asyncFunctionThatCouldFail
breaker.enabled; // $ExpectType boolean
breaker.pendingClose; // $ExpectType boolean
breaker.closed; // $ExpectType boolean
breaker.opened; // $ExpectType boolean
breaker.halfOpen; // $ExpectType boolean
breaker.warmUp; // $ExpectType boolean
breaker.isShutdown; // $ExpectType boolean
breaker.volumeThreshold; // $ExpectType number
breaker.status.stats.latencyMean; // $ExpectType number
breaker.stats.latencyTimes; // $ExpectType number[]
breaker.hystrixStats.getHystrixStream().removeAllListeners();
breaker.clearCache(); // $ExpectType void
breaker.open(); // $ExpectType void
breaker.close(); // $ExpectType void
breaker.disable(); // $ExpectType void
breaker.enable(); // $ExpectType void
breaker.shutdown(); // $ExpectType void
// The following are examples are from the libs README and official documentation
// https://nodeshift.github.io/opossum/index.html.
function asyncFunctionThatCouldFail(x: any, y: any) {
return new Promise((resolve, reject) => {
// Do something, maybe on the network or a disk
resolve([x, y]);
});
}
const options: CircuitBreakerOptions = {
timeout: 3000, // If our function takes longer than 3 seconds, trigger a failure