fix(ds): pass topics to `emqx_topic:words/1` before feeding LTS tree

So that empty levels in topics will be properly mapped into `''` atoms.
This commit is contained in:
Andrew Mayorov 2023-12-04 13:12:27 +03:00
parent 92c4b29a4c
commit 130a5a5442
No known key found for this signature in database
GPG Key ID: 2837C62ACFBFED5D
1 changed files with 2 additions and 2 deletions

View File

@ -368,7 +368,7 @@ check_message(
#{?tag := ?IT, ?start_time := StartTime, ?topic_filter := TopicFilter},
#message{timestamp = Timestamp, topic = Topic}
) when Timestamp >= StartTime ->
emqx_topic:match(emqx_topic:words(Topic), TopicFilter);
emqx_topic:match(emqx_topic:tokens(Topic), TopicFilter);
check_message(_Cutoff, _It, _Msg) ->
false.
@ -378,7 +378,7 @@ format_key(KeyMapper, Key) ->
-spec make_key(s(), emqx_types:message()) -> {binary(), [binary()]}.
make_key(#s{keymappers = KeyMappers, trie = Trie}, #message{timestamp = Timestamp, topic = TopicBin}) ->
Tokens = emqx_topic:tokens(TopicBin),
Tokens = emqx_topic:words(TopicBin),
{TopicIndex, Varying} = emqx_ds_lts:topic_key(Trie, fun threshold_fun/1, Tokens),
VaryingHashes = [hash_topic_level(I) || I <- Varying],
KeyMapper = array:get(length(Varying), KeyMappers),