aboutsummaryrefslogtreecommitdiff
path: root/src/mod_offline_sql.erl
diff options
context:
space:
mode:
authorEvgeny Khramtsov <ekhramtsov@process-one.net>2018-12-10 11:57:04 +0300
committerEvgeny Khramtsov <ekhramtsov@process-one.net>2018-12-10 11:57:04 +0300
commit74e8c0376f8d3d292205a1b7ab1908570c4272f1 (patch)
treeec3a85ba40483e5054c258a756600f2556611b18 /src/mod_offline_sql.erl
parentAvoid badfun in multicast/6 (diff)
parentDon't lose carbons on presence change or session resumption (diff)
Merge branch 'master' into mix
Diffstat (limited to 'src/mod_offline_sql.erl')
-rw-r--r--src/mod_offline_sql.erl13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mod_offline_sql.erl b/src/mod_offline_sql.erl
index c114b1dce..f2cc682d6 100644
--- a/src/mod_offline_sql.erl
+++ b/src/mod_offline_sql.erl
@@ -90,8 +90,17 @@ remove_expired_messages(_LServer) ->
remove_old_messages(Days, LServer) ->
case ejabberd_sql:sql_query(
LServer,
- ?SQL("DELETE FROM spool"
- " WHERE created_at < NOW() - INTERVAL %(Days)d DAY")) of
+ fun(pgsql, _) ->
+ ejabberd_sql:sql_query_t(
+ ?SQL("DELETE FROM spool"
+ " WHERE created_at <"
+ " NOW() - INTERVAL '%(Days)d DAY'"));
+ (_, _) ->
+ ejabberd_sql:sql_query_t(
+ ?SQL("DELETE FROM spool"
+ " WHERE created_at < NOW() - INTERVAL %(Days)d DAY"))
+ end)
+ of
{updated, N} ->
?INFO_MSG("~p message(s) deleted from offline spool", [N]);
_Error ->