-
Notifications
You must be signed in to change notification settings - Fork 429
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
[markers] Implement all configuration for the smart_markers #3546
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Codecov Report
@@ Coverage Diff @@
## feature/smart_markers #3546 +/- ##
=========================================================
+ Coverage 80.83% 80.89% +0.06%
=========================================================
Files 425 426 +1
Lines 32273 32351 +78
=========================================================
+ Hits 26087 26171 +84
+ Misses 6186 6180 -6
Continue to review full report at Codecov.
|
f83207a
to
66595bd
Compare
1e68321
to
c8c955d
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.
This comment was marked as outdated.
This comment was marked as outdated.
small_tests_24 / small_tests / e0086bf small_tests_23 / small_tests / e0086bf dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / e0086bf dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / e0086bf dynamic_domains_mysql_redis_24 / mysql_redis / e0086bf dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / e0086bf ldap_mnesia_23 / ldap_mnesia / e0086bf ldap_mnesia_24 / ldap_mnesia / e0086bf pgsql_mnesia_23 / pgsql_mnesia / e0086bf pgsql_mnesia_24 / pgsql_mnesia / e0086bf elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / e0086bf internal_mnesia_24 / internal_mnesia / e0086bf mysql_redis_24 / mysql_redis / e0086bf mssql_mnesia_24 / odbc_mssql_mnesia / e0086bf riak_mnesia_24 / riak_mnesia / e0086bf |
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.
ok, added some comments, otherwise - ok
Private :: boolean()) -> [mod_smart_markers:chat_marker()]. | ||
get_conv_chat_marker(HostType, From, To = #jid{lserver = TLS}, Thread, TS, Private) -> | ||
% If To is a room, we'll want to check just the room | ||
case mongoose_domain_api:get_subdomain_host_type(TLS) of |
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.
ToLServer or ToServer (TLS and TLU are confusing)
type => decode_type(Type), | ||
timestamp => decode_timestamp(MsgTS), | ||
id => MsgId} | ||
|| {LS, LU, ToJid, MsgThread, Type, MsgId, MsgTS} <- ChatMarkers]. |
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.
tuple_to_map helper function would be useful here (also code dedup)
@@ -0,0 +1,118 @@ | |||
%%%---------------------------------------------------------------------------- | |||
%%% @copyright (C) 2020, Erlang Solutions Ltd. | |||
%%% @doc |
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.
@doc
on one line
Msgs = [ escalus:wait_for_stanza(User) || User <- Users], | ||
get_id(hd(Msgs), MsgId). | ||
|
||
mark_msg(Users, RoomBinJid, Marker, StzId) -> |
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.
just StanzaId, there is zero benefits to use a short form
escalus:send(Writer, Msg), | ||
[ escalus:wait_for_stanza(User) || User <- Users], | ||
Msgs = [ escalus:wait_for_stanza(User) || User <- Users], |
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.
Users ]
_ -> [{<<"after">>, After}] | ||
end, | ||
Iq = iq_fetch_marker(MarkedUserBJid ++ MaybeThread ++ MaybeAfter), | ||
mongoose_helper:wait_until( |
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.
wait until which waits for what exactly? (probably for not a crash, but still)
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.
Until it all returns fine, without crashing. There's a bunch of asserts inside that might fail but are eventually working, it just needs to fetch the iq again.
<<"type">>, <<"groupchat">>), | ||
[ begin | ||
escalus:send(User, ChatMarker), | ||
{ok, MUser} = verify_marker_fetch(User, RoomBinJid), |
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.
MUser
is a bad name for a list of elements.
Req = maps:from_list(SubEl#xmlel.attrs), | ||
MaybePeer = jid:from_binary(maps:get(<<"peer">>, Req, undefined)), | ||
MaybeAfter = parse_ts(maps:get(<<"after">>, Req, undefined)), | ||
MaybeTread = maps:get(<<"thread">>, Req, undefined), |
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.
MaybeThread
|
||
-spec start_pool(mongooseim:host_type(), mongoose_async_pools:pool_opts()) -> term(). | ||
start_pool(HostType, Opts) -> | ||
catch mongoose_async_pools:start_pool(HostType, smart_markers, Opts). |
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.
report errors?
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.
This only happens during testing, where pools are turned on and off. For some reason out of the scope of this PR ejabberd_sup was still having the children somewhere there.
small_tests_24 / small_tests / 29480e0 small_tests_23 / small_tests / 29480e0 dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 29480e0 dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / 29480e0 dynamic_domains_mysql_redis_24 / mysql_redis / 29480e0 ldap_mnesia_23 / ldap_mnesia / 29480e0 internal_mnesia_24 / internal_mnesia / 29480e0 ldap_mnesia_24 / ldap_mnesia / 29480e0 dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / 29480e0 pgsql_mnesia_24 / pgsql_mnesia / 29480e0 elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / 29480e0 pgsql_mnesia_23 / pgsql_mnesia / 29480e0 mysql_redis_24 / mysql_redis / 29480e0 mssql_mnesia_24 / odbc_mssql_mnesia / 29480e0 riak_mnesia_24 / riak_mnesia / 29480e0 |
Implement the functionality as described in #3535