@SentinelResource踩坑记录:blockHandler兜底方法找不到

本文通过实战演示了如何使用Sentinel实现降级熔断功能,并详细解析了@SentinelResource注解的blockHandler兜底方法未能生效的原因。文章列举了两种常见问题及其解决办法。

初学Sentinel降级熔断,虽然Sentinel流控生效了,但@SentinelResource的blockHandler兜底方法总是找不到,经过多次了调试终于发现自己眼神多么不好,好吧,列出两种情况:

  1. 兜底方法和@SentinelResource标记方法都在同个类里,形参不一致导致兜底方法找不到
    在这里插入图片描述
  2. 兜底方法和@SentinelResource标记方法在不同的类里,没加static修饰兜底方法,没能保证兜底方法的唯一性从而导致兜底方法找不到
    在这里插入图片描述

给簇点上QPS阈值1,Postman测试一秒之内发送两次请求,OK,Whitelabel Error Page再见
在这里插入图片描述
在这里插入图片描述

index.js:15455 [XHRLoader] Failed to load resource as json (Status 0): https://model.oml2d.com/Senko_Normals/senko.model3.json warn @ index.js:15455 s.onerror @ index.js:15897 XMLHttpRequest.send (匿名) @ index.js:15919 io.loader @ index.js:15916 a @ index.js:15934 yd @ index.js:15923 load @ index.js:15942 (匿名) @ index.js:15972 (匿名) @ index.js:15439 Te @ index.js:15425 bd @ index.js:15970 a @ index.js:15934 (匿名) @ index.js:16344 (匿名) @ index.js:15439 Te @ index.js:15425 ll.factory @ index.js:16324 a @ index.js:15934 (匿名) @ index.js:16426 (匿名) @ index.js:15439 Te @ index.js:15425 ao.factory @ index.js:16407 a @ index.js:15934 yd @ index.js:15923 (匿名) @ index.js:16069 (匿名) @ index.js:15439 Te @ index.js:15425 setupLive2DModel @ index.js:16067 fromSync @ index.js:16207 (匿名) @ index.js:21105 create @ index.js:21102 (匿名) @ index.js:28371 s @ index.js:16 Promise.then u @ index.js:26 (匿名) @ index.js:27 ar @ index.js:13 loadModel @ index.js:28365 initialize @ index.js:28449 cA @ index.js:28287 pA @ index.js:28543 (匿名) @ App.vue:6 (匿名) @ runtime-core.esm-bundler.js:2836 callWithErrorHandling @ runtime-core.esm-bundler.js:199 callWithAsyncErrorHandling @ runtime-core.esm-bundler.js:206 hook.__weh.hook.__weh @ runtime-core.esm-bundler.js:2816 flushPostFlushCbs @ runtime-core.esm-bundler.js:385 render2 @ runtime-core.esm-bundler.js:6043 mount @ runtime-core.esm-bundler.js:3962 app.mount @ runtime-dom.esm-bundler.js:1774 (匿名) @ main.js:3 index.js:16255 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'width') at wd._calculateBounds (index.js:16255:68) at t.calculateBounds (index.js:15331:34) at t.getBounds (index.js:14993:241) at t.getLocalBounds (index.js:15000:20) at t.getLocalBounds (index.js:15344:42) at wd.get (index.js:15402:36) at get modelSize (index.js:21147:53) at index.js:28375:209 _calculateBounds @ index.js:16255 t.calculateBounds @ index.js:15331 t.getBounds @ index.js:14993 t.getLocalBounds @ index.js:15000 t.getLocalBounds @ index.js:15344 get @ index.js:15402 get modelSize @ index.js:21147 (匿名) @ index.js:28375 Promise.then (匿名) @ index.js:28373 s @ index.js:16 Promise.then u @ index.js:26 (匿名) @ index.js:27 ar @ index.js:13 loadModel @ index.js:28365 initialize @ index.js:28449 cA @ index.js:28287 pA @ index.js:28543 (匿名) @ App.vue:6 (匿名) @ runtime-core.esm-bundler.js:2836 callWithErrorHandling @ runtime-core.esm-bundler.js:199 callWithAsyncErrorHandling @ runtime-core.esm-bundler.js:206 hook.__weh.hook.__weh @ runtime-core.esm-bundler.js:2816 flushPostFlushCbs @ runtime-core.esm-bundler.js:385 render2 @ runtime-core.esm-bundler.js:6043 mount @ runtime-core.esm-bundler.js:3962 app.mount @ runtime-dom.esm-bundler.js:1774 (匿名) @ main.js:3 index.js:15325 Uncaught TypeError: Cannot read properties of null (reading 'transform') at t.updateTransform (index.js:15325:132) at t.updateTransform (index.js:15328:24) at t.render (index.js:14441:13) at i5.render (index.js:27133:21) at i5.emit (index.js:10421:42) at i5.update (index.js:10508:17) at _tick (index.js:10438:46) 一直显示加载失败
06-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值