delete too old messages
This commit is contained in:
parent
8c253396e8
commit
99c21690c2
2 changed files with 4 additions and 0 deletions
|
|
@ -19,3 +19,5 @@ enabled = true
|
|||
# note, that big number can slow requests if there
|
||||
# is a huge message backlog (typically after broker outage)
|
||||
batch_size = 100
|
||||
# how old messages should be stored (hours)
|
||||
max_age = 24
|
||||
|
|
|
|||
|
|
@ -336,6 +336,8 @@ def query_from_db():
|
|||
c = context.cnx.cursor()
|
||||
c.execute('BEGIN')
|
||||
c.execute('LOCK TABLE proton_queue IN ACCESS EXCLUSIVE MODE NOWAIT')
|
||||
c.execute("DELETE FROM proton_queue WHERE created_ts < NOW() -'%s hours'::interval" %
|
||||
CONFIG.getint('queue', 'age', fallback=24))
|
||||
query = QueryProcessor(tables=('proton_queue',),
|
||||
columns=('id', 'address', 'props', 'body'),
|
||||
opts={'order': 'id', 'limit': limit})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue