Add automatic MessageCache cleanup on startup
This commit is contained in:
parent
230654f52e
commit
1186ba1109
1 changed files with 8 additions and 0 deletions
|
@ -278,6 +278,14 @@ namespace Noikoio.RegexBot.Module.ModLogs
|
||||||
+ ")";
|
+ ")";
|
||||||
c.ExecuteNonQuery();
|
c.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For lack of an automated mechanism, delete old messages on startup here.
|
||||||
|
using (var c = db.CreateCommand())
|
||||||
|
{
|
||||||
|
c.CommandText = "DELETE FROM " + TableMessage + " WHERE " +
|
||||||
|
"coalesce(edited_ts, created_ts) < (now() - interval '90 days')";
|
||||||
|
c.ExecuteNonQuery();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue