Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use map syntax to pass ranch transport options #2188

Merged
merged 1 commit into from
Jan 9, 2019
Merged

Conversation

michalwski
Copy link
Contributor

After upgrading Cowboy to version 2.6 Ranch was automatically upgraded to version 1.7. This version deprecates old API where transport options are passed as proplists where socket options are mixed with other ranch specific options.
This PR uses the new map syntax where all socket specific options like port, ip and ssl_opts are passed as socket_opts key in the map.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Jan 9, 2019

6091.1 / Erlang 19.3 / small_tests / 465fbb3
Reports root / small


6091.5 / Erlang 19.3 / ldap_mnesia / 465fbb3
Reports root/ big
OK: 1137 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


6091.6 / Erlang 19.3 / elasticsearch_and_cassandra_mnesia / 465fbb3
Reports root/ big
OK: 445 / Failed: 0 / User-skipped: 8 / Auto-skipped: 0


6091.3 / Erlang 19.3 / mysql_redis / 465fbb3
Reports root/ big
OK: 2944 / Failed: 0 / User-skipped: 223 / Auto-skipped: 0


6091.2 / Erlang 19.3 / internal_mnesia / 465fbb3
Reports root/ big
OK: 1173 / Failed: 0 / User-skipped: 52 / Auto-skipped: 0


6091.4 / Erlang 19.3 / odbc_mssql_mnesia / 465fbb3
Reports root/ big
OK: 2958 / Failed: 0 / User-skipped: 209 / Auto-skipped: 0


6091.8 / Erlang 20.0 / pgsql_mnesia / 465fbb3
Reports root/ big / small
OK: 2990 / Failed: 0 / User-skipped: 177 / Auto-skipped: 0


6091.9 / Erlang 21.0 / riak_mnesia / 465fbb3
Reports root/ big / small
OK: 1396 / Failed: 0 / User-skipped: 50 / Auto-skipped: 0

Copy link
Contributor

@aleklisi aleklisi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for PR 👍 Looks good, I have one minor refactor suggestion ;)

src/ejabberd_cowboy.erl Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jan 9, 2019

Codecov Report

Merging #2188 into master will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2188      +/-   ##
=========================================
+ Coverage   78.63%   78.7%   +0.06%     
=========================================
  Files         329     329              
  Lines       28448   28447       -1     
=========================================
+ Hits        22370   22389      +19     
+ Misses       6078    6058      -20
Impacted Files Coverage Δ
src/ejabberd_cowboy.erl 90.21% <100%> (-0.11%) ⬇️
src/mod_muc_log.erl 77.69% <0%> (ø) ⬆️
src/mam/mod_mam_utils.erl 83.05% <0%> (+0.67%) ⬆️
src/mam/mod_mam_rdbms_arch.erl 90.54% <0%> (+0.9%) ⬆️
...c/global_distrib/mod_global_distrib_server_mgr.erl 85.21% <0%> (+2.11%) ⬆️
src/rdbms/mongoose_rdbms_odbc.erl 81.01% <0%> (+2.53%) ⬆️
src/rdbms/mongoose_rdbms.erl 69.94% <0%> (+2.73%) ⬆️
src/mam/mod_mam_rdbms_prefs.erl 96.26% <0%> (+3.73%) ⬆️
src/gen_iq_handler.erl 61.36% <0%> (+4.54%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e8617e0...7832417. Read the comment docs.

@@ -127,12 +128,13 @@ do_start_cowboy(Ref, Opts, Retries, SleepTime) ->
do_start_cowboy(Ref, Opts) ->
SSLOpts = gen_mod:get_opt(ssl, Opts, undefined),
NumAcceptors = gen_mod:get_opt(num_acceptors, Opts, 100),
TransportOpts = gen_mod:get_opt(transport_options, Opts, []),
TransportOpts0 = gen_mod:get_opt(transport_options, Opts, #{}),
TransportOpts = TransportOpts0#{numb_acceptros => NumAcceptors},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like typo, should be num_acceptors

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Thanks for spotting it so quickly!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just force pushed a fix for that.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Jan 9, 2019

6092.1 / Erlang 19.3 / small_tests / 51ed45c
Reports root / small


6092.5 / Erlang 19.3 / ldap_mnesia / 51ed45c
Reports root/ big
OK: 1137 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


6092.6 / Erlang 19.3 / elasticsearch_and_cassandra_mnesia / 51ed45c
Reports root/ big
OK: 445 / Failed: 0 / User-skipped: 8 / Auto-skipped: 0


6092.3 / Erlang 19.3 / mysql_redis / 51ed45c
Reports root/ big
OK: 2944 / Failed: 0 / User-skipped: 223 / Auto-skipped: 0


6092.2 / Erlang 19.3 / internal_mnesia / 51ed45c
Reports root/ big
OK: 1173 / Failed: 0 / User-skipped: 52 / Auto-skipped: 0


6092.4 / Erlang 19.3 / odbc_mssql_mnesia / 51ed45c
Reports root/ big
OK: 2958 / Failed: 0 / User-skipped: 209 / Auto-skipped: 0


6092.8 / Erlang 20.0 / pgsql_mnesia / 51ed45c
Reports root/ big / small
OK: 2990 / Failed: 0 / User-skipped: 177 / Auto-skipped: 0


6092.9 / Erlang 21.0 / riak_mnesia / 51ed45c
Reports root/ big / small
OK: 1431 / Failed: 3 / User-skipped: 50 / Auto-skipped: 0

pep_SUITE:pep_tests:unsubscribe_after_presence_unsubscription
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,<<"alicE82.937826@localhost/res1">>,escalus_tcp,
          <0.8865.1>,
          [{event_manager,<0.8817.1>},
           {server,<<"localhost">>},
           {username,<<"alicE82.937826">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.8817.1>},
            {server,<<"localhost">>},
            {username,<<"alicE82.937826">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,<<"alicE82.937826">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,{escalus_auth,auth_plain}},
           {wspath,undefined},
           {username,<<"alicE82.937826">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"19B9F62A64D9EEF3">>}]},
        5000],
       [{file,
          "/home/travis/build/esl/MongooseIM/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,138}]},
     {pubsub_tools,receive_response,3,
       [{file,"pubsub_tools.erl"},{line,446}]},
     {pubsub_tools,receive_and_check_response,4,
       [{file,"pubsub_tools.erl"},{line,437}]},
     {pep_SUITE,'-unsubscribe_after_presence_unsubscription/1-fun-0-',2,
       [{file,"pep_SUITE.erl"},{line,286}]},
     {escalus_story,story,4,
       [{file,
          "/home/travis/build/esl/MongooseIM/big_tests/_build/d...

Report log

pubsub_SUITE:dag+basic:retract_when_user_goes_offline_test
{error,
  {function_clause,
    [{lists,zip,
       [[{xmlel,<<"item">>,
           [{<<"id">>,<<"item1">>}],
           [{xmlel,<<"entry">>,
            [{<<"xmlns">>,<<"http://www.w3.org/2005/Atom">>}],
            []}]}],
        []],
       [{file,"lists.erl"},{line,387}]},
     {lists,zip,2,[{file,"lists.erl"},{line,387}]},
     {pubsub_tools,check_items,3,[{file,"pubsub_tools.erl"},{line,539}]},
     {pubsub_SUITE,'-retract_when_user_goes_offline_test/1-fun-0-',3,
       [{file,"pubsub_SUITE.erl"},{line,649}]},
     {escalus_story,story,4,
       [{file,
          "/home/travis/build/esl/MongooseIM/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
        {line,72}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1545}]},
     {test_server,run_test_case_eval1,6,
       [{file,"test_server.erl"},{line,1063}]},
     {test_server,run_test_case_eval,9,
       [{file,"test_server.erl"},{line,995}]}]}}

Report log

mod_global_distrib_SUITE:mod_global_distrib:test_pm_with_ungraceful_reconnection_to_different_server
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,<<"eve82.66108@localhost/res1">>,escalus_tcp,
          <0.24925.1>,
          [{event_manager,<0.24916.1>},
           {server,<<"localhost">>},
           {username,<<"eve82.66108">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.24916.1>},
            {server,<<"localhost">>},
            {username,<<"eve82.66108">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,<<"eve82.66108">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,{escalus_auth,auth_plain}},
           {wspath,undefined},
           {username,<<"eve82.66108">>},
           {server,<<"localhost">>},
           {password,<<"password">>},
           {port,5222},
           {stream_management,true},
           {stream_id,<<"A69689EC042AFA85">>}]},
        10000],
       [{file,
          "/home/travis/build/esl/MongooseIM/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,138}]},
     {mod_global_distrib_SUITE,
       '-test_pm_with_ungraceful_reconnection_to_different_server/1-fun-0-',
       4,
       [{file,"mod_global_distrib_SUITE.erl"},{line,607}]},
     {escalus_story,story,4,
       [{file,
          "/home/travis/build/esl/MongooseIM/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
        {line,72}]},
     {tes...

Report log

@aleklisi aleklisi merged commit bfdfe02 into master Jan 9, 2019
@fenek fenek deleted the fix-ranch-usage branch January 9, 2019 15:03
@fenek fenek added this to the 3.2.0++ milestone Jan 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants