summaryrefslogtreecommitdiff
path: root/cinder/message
diff options
context:
space:
mode:
authorTommyLike <tommylikehu@gmail.com>2017-03-23 17:23:15 +0800
committerTommyLike <tommylikehu@gmail.com>2017-04-18 01:09:19 +0000
commitdd42d0af96dac3a7764eeaf5bdd4c7fe29b2bc60 (patch)
tree27e1cba9af7943e965bf7ecf30af9469d9b001e6 /cinder/message
parent4d71d60da62b3717cd1020f2192476a3d3876e0a (diff)
downloadcinder-dd42d0af96dac3a7764eeaf5bdd4c7fe29b2bc60.tar.gz
Clean up expired user messages
Use periodic task to clean up expired messages. Change-Id: Ia44f46497b8a515de73e73c0ad70966a094a9b76 Partial-Implements: blueprint summarymessage
Diffstat (limited to 'cinder/message')
-rw-r--r--cinder/message/api.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/cinder/message/api.py b/cinder/message/api.py
index b8025fa37..0e5d318ee 100644
--- a/cinder/message/api.py
+++ b/cinder/message/api.py
@@ -24,7 +24,11 @@ from cinder.message import defined_messages
messages_opts = [
cfg.IntOpt('message_ttl', default=2592000,
- help='message minimum life in seconds.')]
+ help='message minimum life in seconds.'),
+ cfg.IntOpt('message_reap_interval', default=86400,
+ help='interval between period task to clean expired messages.')
+]
+
CONF = cfg.CONF
CONF.register_opts(messages_opts)
@@ -80,3 +84,8 @@ class API(base.Base):
"""Delete message with the specified id."""
ctx = context.elevated()
return self.db.message_destroy(ctx, id)
+
+ def cleanup_expired_messages(self, context):
+ ctx = context.elevated()
+ count = self.db.cleanup_expired_messages(ctx)
+ LOG.info("Deleted %s expired messages.", count)