[Groonga-commit] ranguba/chupa-text at 742b4ec [master] Add more log for external command timeout

Back to archive index
Kouhei Sutou null+****@clear*****
Sun Mar 3 07:42:02 JST 2019


Kouhei Sutou	2019-03-03 07:42:02 +0900 (Sun, 03 Mar 2019)

  Revision: 742b4ec3531d15f2771b999e490d35d027a67e16
  https://github.com/ranguba/chupa-text/commit/742b4ec3531d15f2771b999e490d35d027a67e16

  Message:
    Add more log for external command timeout

  Modified files:
    lib/chupa-text/external-command.rb

  Modified: lib/chupa-text/external-command.rb (+6 -1)
===================================================================
--- lib/chupa-text/external-command.rb    2019-03-03 07:29:27 +0900 (05fc10f)
+++ lib/chupa-text/external-command.rb    2019-03-03 07:42:02 +0900 (97530b9)
@@ -164,17 +164,22 @@ module ChupaText
     end
 
     def wait_process(pid, timeout)
+      tag = "[timeout]"
+
       if timeout.nil?
         timeout_env = ENV["CHUPA_TEXT_EXTERNAL_COMMAND_TIMEOUT"]
-        timeout = parse_time("[timeout]", timeout_env) if timeout_env
+        timeout = parse_time(tag, timeout_env) if timeout_env
       end
 
       if timeout
+        info("#{log_tag}#{tag}[use] <#{timeout}s>: <#{pid}>")
         status = wait_process_timeout(pid, timeout)
         return status if status
+        info("#{log_tag}#{tag}[terminate] <#{pid}>")
         Process.kill(:TERM, pid)
         status = wait_process_timeout(pid, 5)
         return status if status
+        info("#{log_tag}#{tag}[kill] <#{pid}>")
         Process.kill(:KILL, pid)
       end
       _, status = Process.waitpid2(pid)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190303/64b02115/attachment-0001.html>


More information about the Groonga-commit mailing list
Back to archive index