-
Notifications
You must be signed in to change notification settings - Fork 428
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
Refactor/presences #4207
Refactor/presences #4207
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #4207 +/- ##
==========================================
+ Coverage 84.32% 84.35% +0.02%
==========================================
Files 552 552
Lines 33459 33436 -23
==========================================
- Hits 28215 28204 -11
+ Misses 5244 5232 -12 ☔ View full report in Codecov by Sentry. |
ef7b9c8
to
822573b
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
04e23b9
to
79547ea
Compare
elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / 79547ea small_tests_25 / small_tests / 79547ea small_tests_26 / small_tests / 79547ea small_tests_26_arm64 / small_tests / 79547ea ldap_mnesia_25 / ldap_mnesia / 79547ea ldap_mnesia_26 / ldap_mnesia / 79547ea dynamic_domains_mysql_redis_26 / mysql_redis / 79547ea dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 79547ea dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 79547ea dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / 79547ea pgsql_cets_26 / pgsql_cets / 79547ea internal_mnesia_26 / internal_mnesia / 79547ea pubsub_SUITE:dag+basic:publish_with_max_items_test{error,{{badmatch,false},
[{pubsub_tools,check_response,2,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,444}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,434}]},
{pubsub_tools,receive_and_check_response,4,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,424}]},
{escalus_story,story,4,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
{line,72}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1793}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1302}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1234}]}]}} sm_SUITE:ping_timeout{error,
{{assertion_failed,assert,is_presence,
{xmlel,<<"iq">>,
[{<<"from">>,<<"localhost">>},
{<<"to">>,
<<"alice_ping_timeout_2051@localhost/escalus-default-resource">>},
{<<"type">>,<<"get">>},
{<<"id">>,<<"18ef4356ca52f7a5">>}],
[{xmlel,<<"ping">>,[{<<"xmlns">>,<<"urn:xmpp:ping">>}],[]}]},
"<iq from='localhost' to='alice_ping_timeout_2051@localhost/escalus-default-resource' type='get' id='18ef4356ca52f7a5'><ping xmlns='urn:xmpp:ping'/></iq>"},
[{escalus_new_assert,assert_true,2,
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
{line,84}]},
{sm_helper,initial_presence_step,2,
[{file,"/home/circleci/project/big_tests/tests/sm_helper.erl"},
{line,135}]},
{escalus_connection,connection_step,2,
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_connection.erl"},
{line,163}]},
{lists,foldl_1,3,[{file,"lists.erl"},{line,1599}]},
{escalus_connection,start,2,
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_connection.erl"},
{line,145}]},
{sm_helper,connect_spec,3,
[{file,"/home/circleci/project/big_tests/tests/sm_helper.erl"},
{line,153}]},
{sm_SUITE,ping_timeout,1,
[{file,"/home/circleci/project/big_tests/tests/sm_SUITE.erl"},
{line,625}]},
{test_server,ts_tc,3,[{file,"test_ser... pgsql_mnesia_25 / pgsql_mnesia / 79547ea pgsql_mnesia_26 / pgsql_mnesia / 79547ea mysql_redis_26 / mysql_redis / 79547ea mssql_mnesia_26 / odbc_mssql_mnesia / 79547ea graphql_muc_light_SUITE:user:user_muc_light:end_per_group{error,
{{unregistering_failed,
{amount,1},
{unregistered_items,
[{{<<"_user_send_message_to_room_errors_1018">>,
[{escalus_event_mgr,<0.23277.0>},
{tc_name,user_send_message_to_room_errors},
{escalus_cleaner,<0.23276.0>},
{watchdog,<0.23275.0>},
{muc_light_host,<<"muclight.localhost">>},
{secondary_muc_light_host,<<"muclight.localhost.bis">>},
{schema_endpoint,user},
{{ejabberd_cwd,mongooseim@localhost},
"/home/circleci/project/_build/mim1/rel/mongooseim"},
{preset,"odbc_mssql_mnesia"},
{mim_data_dir,
"/home/circleci/project/big_tests/tests/graphql_muc_light_SUITE_data"},
{tc_logfile,
"https://circleci-mim-results.s3.eu-central-1.amazonaws.com/PR/4207/205876/odbc_mssql_mnesia.26.1.2-amd64/big/ct_run.test%4003c247d4a9fa.2024-01-16_16.30.11/big_tests.tests.graphql_muc_light_SUITE.logs/run.2024-01-16_16.34.48/graphql_muc_light_suite.user_send_message_to_room_errors.61826.html"},
{tc_group_properties,[{name,user_muc_light},parallel]},
{tc_group_path,[[{name,user}]]},
{data_dir,
"/home/circleci/project/big_tests/_build/default/lib/mongoose_tests/ebin/graphql_muc_light_SUITE_data/"},
{priv_dir,
"https://circleci-mim-results.s3.eu-central-1.amazonaws.com/PR/4207/205876/odbc_mssql_mnesia.26.1.2-amd64/big/ct_run.test%4003c247d4a9fa.2024-01-16_16.30.11/big_tests.tests.graphql_muc_light_SUITE.logs/run.2024-01-16_16.34.48/log_private/"},
{{saved_modules,mongooseim@localhost,<<"localhost">>},
#{mod_vcard =>
#{matches => 30,
host => {prefix,<<"vjud.">>},
search => true,backend => rdbms,iqdisc => pa... internal_mnesia_26 / internal_mnesia / 79547ea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks ok, one type
src/mod_presence.erl
Outdated
get_presence_type(Acc) -> | ||
case mongoose_acc:stanza_type(Acc) of | ||
%% Note that according to https://www.rfc-editor.org/rfc/rfc6121.html#section-4.7.1 | ||
%% there is no defailt value nor "available" is considered a valid type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%% there is no defailt value nor "available" is considered a valid type. | |
%% there is no default value nor "available" is considered a valid type. |
The idea is to keep track of a smaller set of data, I'm assuming that jids that would fall both on pres_f and pres_t are common, so we can keep track of them only once instead of duplicating. This way we also give a meaning to the values of the map underlying the implementation of sets. Note too that this set is rarely updated: it is build once upon user starting a presence session, and it is updated only on roster changes.
Available and invisible sets can be unified into a map of tagged jids. These sets vary a lot more that subscriptions, as they are changed as peers connect and disconnect.
This is functionality that was deprecated from XMPP already back in 2003 (!), and we still have code for it that has been surviving different XEP advertisement updates as well as shuffling of presences code. Note that this is not related to the https://xmpp.org/extensions/xep-0126.html XEP, as this one achieves the same by usage of privacy lists specific for the purpose, thereby establishing only a client-based protocal that is transparent for the server.
79547ea
to
0a3f2e8
Compare
elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / 0a3f2e8 small_tests_25 / small_tests / 0a3f2e8 small_tests_26 / small_tests / 0a3f2e8 small_tests_26_arm64 / small_tests / 0a3f2e8 dynamic_domains_mysql_redis_26 / mysql_redis / 0a3f2e8 dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 0a3f2e8 ldap_mnesia_26 / ldap_mnesia / 0a3f2e8 dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 0a3f2e8 dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / 0a3f2e8 pgsql_cets_26 / pgsql_cets / 0a3f2e8 internal_mnesia_26 / internal_mnesia / 0a3f2e8 pgsql_mnesia_25 / pgsql_mnesia / 0a3f2e8 mysql_redis_26 / mysql_redis / 0a3f2e8 ldap_mnesia_25 / ldap_mnesia / 0a3f2e8 pgsql_mnesia_26 / pgsql_mnesia / 0a3f2e8 mssql_mnesia_26 / odbc_mssql_mnesia / 0a3f2e8 |
The main points are
This should all make code more readable and hopefully have some minimal performance improvements.