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