gotify / server

A simple server for sending and receiving messages in real-time per WebSocket. (Includes a sleek web-ui)
https://gotify.net
Other
11.41k stars 633 forks source link

Configurable retention period for messages. #376

Open kdurrance opened 3 years ago

kdurrance commented 3 years ago

Pretty self explanatory. Option to automatically prune old messages from the gotify.db en masse. I have a particular chatty application for notifications, which over time could be an issue. Would be great to have configurable retention period for messages, either as a global setting, or an a per-application basis.

jmattheis commented 3 years ago

Let's wait till more users want this feature.

StewartThomson commented 3 years ago

https://godoc.org/github.com/robfig/cron could be useful for this, if a bit overkill

GAS85 commented 3 years ago

It could be done outside of gotify by only API calls. Check this out: https://github.com/GAS85/Gotify-old_Notifications_cleanup

IvanMazzoli commented 1 year ago

+1 on this feature, would be of great use for me

felixq commented 1 year ago

+1. My app can generate around 100 messages per hour and they are only valid for less than 5 minutes.

mateuscelio commented 1 year ago

@jmattheis, I could work on this if you think that this feature is required.

jmattheis commented 1 year ago

@mateuscelio I don't think this feature is required, but feel free to work on it.

For the implementation: Each application should get a separate setting for the retention period. The pruning should be done in a separate goroutine that executes an sql query every minute to prune messages outside of the retention period. The default retention period should be unlimited.