Skip to content

Commit

Permalink
Fix MAM cache name
Browse files Browse the repository at this point in the history
When mod_mam_cache_user checks its cache, it gives its own module name
to mongoose_user_cache so that this one fetches the config to see if it
has configured its own cache or is reusing some other module's cache.
The problem is that mongoose_user_cache will check for the module key,
but it the current implementation, we are hiding it behind a cache key
to contain the cache config.

So by just moving the config a level up, mongoose_user_cache can find it.
  • Loading branch information
NelsonVides committed Mar 15, 2022
1 parent 3a875ec commit 11186ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/mam/mod_mam_cache_user.erl
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
%%====================================================================

-spec start(mongooseim:host_type(), gen_mod:module_opts()) -> ok.
start(HostType, Opts = #{cache := CacheOpts}) ->
start_cache(HostType, CacheOpts),
start(HostType, Opts) ->
start_cache(HostType, Opts),
ejabberd_hooks:add(hooks(HostType, Opts)),
ok.

Expand Down
2 changes: 1 addition & 1 deletion src/mam/mod_mam_meta.erl
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ add_rdbms_deps(user_cache, Type, #{cache_users := true, cache := CacheOpts}, Dep
internal -> Deps;
mod_cache_users -> add_dep(mod_cache_users, Deps)
end,
add_dep(mod_mam_cache_user, #{Type => true, cache => CacheOpts}, Deps1);
add_dep(mod_mam_cache_user, CacheOpts#{Type => true}, Deps1);
add_rdbms_deps(async_writer, Type, #{async_writer := AsyncOpts = #{enabled := true}}, Deps) ->
Deps1 = add_dep(rdbms_arch_module(Type), #{no_writer => true}, Deps),
add_dep(rdbms_async_arch_module(Type), AsyncOpts, Deps1);
Expand Down

0 comments on commit 11186ec

Please sign in to comment.