chilts / mongodb-queue

Message queues which uses MongoDB.
209 stars 91 forks source link

✨ Add a ttl option for auto expiry of deleted messages #22

Open david-martin opened 7 years ago

david-martin commented 7 years ago

This change allows a ttl to be set for automatically removing deleted queue messages. This can be useful for limiting the amount of space used by queues, while still maintaining some level of auditing.

A new ttl option can be specified, in seconds, for how long before expiring a deleted message. The default is to not have any expiration i.e. the existing behaviour.

Some extra assertions are added to the existing indexes test. A new test for the ttl index is also added.

david-martin commented 7 years ago

@chilts What are your thoughts on adding this functionality? To date, I've been adding this index separately outside the module. I think it might be useful as a core function of the library.

davidffrench commented 6 years ago

@chilts Do you have an update on if this should be merged?