机器人 发表于 2013-2-6 23:52:17

rails-exception_notification插件的问题

传送门:
http://railsforum.com/viewtopic.php?id=35270

怎么解决这个问题呢?有什么好办法吗?http://www.agoit.com/images/smiles/icon_redface.gif

怎么异步,怎么新线程?怎么样不阻塞其它的request?怎么样就不会搞死我的web server?

当然首先我认为这是当初设计时引起的问题,但是现在除了不重构代码,怎么hack这个plugin来解决这个问题呢?

================分割线=============================
根据下一站火星的看法,我决定不去考虑异步发信操作,新开ruby线程什么的。还是问题简单化。我决定不使用这个rails-exception_notification插件的发信操作了,我自己将500中的信息保存到数据库,然后再通过email定时来发送500邮件了。

小小的一点点hack这个异常处理的方法
    def rescue_action_in_public(exception)      case exception      when *self.class.exceptions_to_treat_as_404          render_404      else                  render_500          deliverer = self.class.exception_data          data = case deliverer            when nil then {}            when Symbol then send(deliverer)            when Proc then deliverer.call(self)          end          #ExceptionNotifier.deliver_exception_notification(exception, self,            request, data)          # TODO:这样做          # SystemLog.create(".............................")      end    end
页: [1]
查看完整版本: rails-exception_notification插件的问题