YUKI Hiroshi
null+****@clear*****
Tue Apr 14 18:32:46 JST 2015
YUKI Hiroshi 2015-04-14 18:32:46 +0900 (Tue, 14 Apr 2015) New Revision: e2f4ea8bd34bb72c2bcb6ed6abbad9194151f645 https://github.com/droonga/droonga-engine/commit/e2f4ea8bd34bb72c2bcb6ed6abbad9194151f645 Message: Use Fiber#alive? to detect it is finished or not Modified files: lib/droonga/plugin/async_command.rb Modified: lib/droonga/plugin/async_command.rb (+12 -11) =================================================================== --- lib/droonga/plugin/async_command.rb 2015-04-14 16:52:28 +0900 (4f6ff66) +++ lib/droonga/plugin/async_command.rb 2015-04-14 18:32:46 +0900 (f6015b3) @@ -13,6 +13,7 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +require "fiber" require "coolio" require "droonga/loggable" @@ -102,18 +103,18 @@ module Droonga timer = Coolio::TimerWatcher.new(0.1, true) timer.on_timer do - begin - runner.resume - rescue FiberError + if runner.alive? + begin + runner.resume + rescue + timer.detach + logger.trace("start: watcher detached on unexpected exception", + :watcher => timer) + logger.exception(error_message, $!) + error(error_name, error_message) + end + else timer.detach - logger.trace("start: watcher detached on FiberError", - :watcher => timer) - rescue - timer.detach - logger.trace("start: watcher detached on unexpected exception", - :watcher => timer) - logger.exception(error_message, $!) - error(error_name, error_message) end end -------------- next part -------------- HTML����������������������������...Descargar