couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woh...@apache.org
Subject [1/2] couch-log commit: updated refs/heads/master to 194db1a
Date Mon, 27 Mar 2017 20:14:56 GMT
Repository: couchdb-couch-log
Updated Branches:
  refs/heads/master ad803f66d -> 194db1ade


Fix dns timeout for undefined syslog host

On some platforms, inet:getaddr can take several seconds to return when
passed the undefined atom, which is the default value of "syslog_host",
and therefore the value used when running tests. On platforms where it
takes longer to return than the test is allowed to run, the
couch_log_writer_syslog_test will fail with *timed out*.

This short circuits the case when "syslog_host" is undefined, and
removes the race from the test.

COUCHDB-3340


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/commit/24112cf6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/tree/24112cf6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/diff/24112cf6

Branch: refs/heads/master
Commit: 24112cf6ce9ed23029f7697b84548dc8acff28b5
Parents: ad803f6
Author: Jay Doane <jay.s.doane@gmail.com>
Authored: Sun Mar 26 23:46:15 2017 -0700
Committer: Jay Doane <jay.s.doane@gmail.com>
Committed: Sun Mar 26 23:46:15 2017 -0700

----------------------------------------------------------------------
 src/couch_log_writer_syslog.erl | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/blob/24112cf6/src/couch_log_writer_syslog.erl
----------------------------------------------------------------------
diff --git a/src/couch_log_writer_syslog.erl b/src/couch_log_writer_syslog.erl
index 738d162..d918bb7 100644
--- a/src/couch_log_writer_syslog.erl
+++ b/src/couch_log_writer_syslog.erl
@@ -46,13 +46,17 @@
 init() ->
     {ok, Socket} = gen_udp:open(0),
 
-    SysLogHost = config:get("log", "syslog_host"),
-    Host = case inet:getaddr(SysLogHost, inet) of
-        {ok, Address} when SysLogHost /= undefined ->
-            Address;
-        _ ->
-            undefined
-    end,
+    Host = case config:get("log", "syslog_host") of
+        undefined ->
+            undefined;
+        SysLogHost ->
+            case inet:getaddr(SysLogHost, inet) of
+                {ok, Address} ->
+                    Address;
+                _ ->
+                    undefined
+            end
+        end,
 
     {ok, #st{
         socket = Socket,


Mime
View raw message