问题描述
自定义API服务存在一些问题,该服务经常失败,并且在我的Slack频道中生成很多消息。我只想将特定的异常重复发送N次才能发送给Slack。
类似这样的东西:
public function report(Throwable $exception)
{
if ($exception instanceof ApiConnectException) {
$attempts = cache()->increment('request-' . $exception->getCode());
if ($attempts <= 5) {
config()->set('logging.channels.stack.channels','daily');
}
}
parent::report($exception);
}
计数器似乎可以正常工作,但它仍将消息发送到我的闲暇频道。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)