mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
Invalidate proper cache when using mam for offline in pop_messages
This commit is contained in:
parent
8956b7d60d
commit
40c360c607
@ -84,7 +84,6 @@
|
|||||||
%% default value for the maximum number of user messages
|
%% default value for the maximum number of user messages
|
||||||
-define(MAX_USER_MESSAGES, infinity).
|
-define(MAX_USER_MESSAGES, infinity).
|
||||||
|
|
||||||
-define(EMPTY_SPOOL_CACHE, offline_empty_cache).
|
|
||||||
-define(SPOOL_COUNTER_CACHE, offline_msg_counter_cache).
|
-define(SPOOL_COUNTER_CACHE, offline_msg_counter_cache).
|
||||||
|
|
||||||
-type c2s_state() :: ejabberd_c2s:state().
|
-type c2s_state() :: ejabberd_c2s:state().
|
||||||
@ -178,12 +177,6 @@ init_cache(Mod, Host, Opts) ->
|
|||||||
CacheOpts = [{max_size, mod_offline_opt:cache_size(Opts)},
|
CacheOpts = [{max_size, mod_offline_opt:cache_size(Opts)},
|
||||||
{life_time, mod_offline_opt:cache_life_time(Opts)},
|
{life_time, mod_offline_opt:cache_life_time(Opts)},
|
||||||
{cache_missed, false}],
|
{cache_missed, false}],
|
||||||
case mod_offline_opt:use_mam_for_storage(Opts) of
|
|
||||||
true ->
|
|
||||||
ets_cache:new(?EMPTY_SPOOL_CACHE, CacheOpts);
|
|
||||||
false ->
|
|
||||||
ets_cache:delete(?EMPTY_SPOOL_CACHE)
|
|
||||||
end,
|
|
||||||
case use_cache(Mod, Host) of
|
case use_cache(Mod, Host) of
|
||||||
true ->
|
true ->
|
||||||
ets_cache:new(?SPOOL_COUNTER_CACHE, CacheOpts);
|
ets_cache:new(?SPOOL_COUNTER_CACHE, CacheOpts);
|
||||||
@ -626,8 +619,7 @@ route_offline_messages(#{jid := #jid{luser = LUser, lserver = LServer}} = State)
|
|||||||
{ok, OffMsgs} ->
|
{ok, OffMsgs} ->
|
||||||
case use_mam_for_user(LUser, LServer) of
|
case use_mam_for_user(LUser, LServer) of
|
||||||
true ->
|
true ->
|
||||||
ets_cache:delete(?EMPTY_SPOOL_CACHE, {LUser, LServer},
|
flush_cache(Mod, LUser, LServer),
|
||||||
ejabberd_cluster:get_nodes()),
|
|
||||||
lists:map(
|
lists:map(
|
||||||
fun({_, #message{from = From, to = To} = Msg}) ->
|
fun({_, #message{from = From, to = To} = Msg}) ->
|
||||||
#offline_msg{from = From, to = To,
|
#offline_msg{from = From, to = To,
|
||||||
|
Loading…
Reference in New Issue
Block a user