Browse Source

Merge pull request #1861 from blee-techempower/blee-erlang-cowboy

Fix Erlang/cowboy travis-ci test fail issue
Mike Smith 9 years ago
parent
commit
85c2d193be

+ 9 - 0
frameworks/Erlang/cowboy/setup.sh

@@ -1,5 +1,14 @@
 #!/bin/bash
 
+# Caution: "line 11 has flaw." reported by '[email protected]'
+#   Below sed command can cause travis-ci test failing.
+#   Please be aware of testing this on local machine.
+#   If you perform a local test, please apply inverse of   
+#   below command. (hint: ${DBHOST} value must be rollback to
+#   localhost.
+#
+#   I will fix this problem later with better solution. 
+#
 sed -i 's|"benchmarkdbpass", ".*", 3306|"benchmarkdbpass", "'"${DBHOST}"'", 3306|g' src/hello_world_app.erl
 
 fw_depends erlang

+ 8 - 2
frameworks/Erlang/cowboy/src/hello_world_app.erl

@@ -10,10 +10,16 @@
 
 %% API.
 
+%% NOTE: 
+%%   If size of db testpool is too big (e.g: 5000), 
+%%   it will fail travis ci test. So I shrink this to 256.
+%%   [email protected]
+
+
 start(_Type, _Args) ->
         crypto:start(),
         application:start(emysql),
-        emysql:add_pool(test_pool, 5000,
+        emysql:add_pool(test_pool, 256,
           "benchmarkdbuser", "benchmarkdbpass", "localhost", 3306,
           "hello_world", utf8),
 	emysql:prepare(db_stmt, <<"SELECT * FROM World where id = ?">>),
@@ -24,7 +30,7 @@ start(_Type, _Args) ->
       {"/query", query_handler, []}
 		]}
 	]),
-	{ok, _} = cowboy:start_http(http, 5000, [{port, 8080}], [
+	{ok, _} = cowboy:start_http(http, 256, [{port, 8080}], [
 		{env, [{dispatch, Dispatch}]}
 	]),
 	hello_world_sup:start_link().