Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Auto remove messages after predefined timeout #4206

Closed
wants to merge 6 commits into from

Conversation

cuongnv
Copy link

@cuongnv cuongnv commented Nov 20, 2018

I created a script that can run as cronjob to auto remove with predefined timeout.
You can choose which rooms to remove with predefined timeout or vice versa. Also, It scripts can clean up database after removed message with redacted API

@rubo77
Copy link
Contributor

rubo77 commented Nov 20, 2018

Looks great,

Can you adapt this to PostgreSQL?

@cuongnv
Copy link
Author

cuongnv commented Nov 20, 2018

@rubo77 : Ok. I will :)

@rubo77
Copy link
Contributor

rubo77 commented Nov 20, 2018

there should be a postgres and an sqlite option, (maybe one in comments)

And don't forget a description in the head of the file (or add a readme)

@rubo77
Copy link
Contributor

rubo77 commented Jun 15, 2019

@rubo77 : Ok. I will :)

what about your promise?


Tipp: About your 99 modified files: you should reset your branch to one commit before and rebase to current master instead of the mess you have done ;)

@richvdh
Copy link
Member

richvdh commented Jun 27, 2019

This PR seems to have gone stale, and needs work to clean it up. Closing it for now; feel free to open a new PR based on latest develop if you're still interested in working on it.

@richvdh richvdh closed this Jun 27, 2019
@cuongnv
Copy link
Author

cuongnv commented Nov 14, 2019

@rubo77 : Ok. I will :)

what about your promise?

Tipp: About your 99 modified files: you should reset your branch to one commit before and rebase to current master instead of the mess you have done ;)

I did it. However, after run in long time (several months, remove too much messages (via cronjob 5min run once), it can slow down your server because server have to process many redact requests and server itself implement some throttle control techique.
If you are still interested this solution, you can check my script in attachments.
autoremove_v5.py.zip

@anoadragon453
Copy link
Member

Please do not just try running the above script on your database.

In its current form, it will set the content field of events to an empty string, which is invalid. This will break sync and likely other things, as we saw here.

@cuongnv
Copy link
Author

cuongnv commented Aug 27, 2021

Please do not just try running the above script on your database.

In its current form, it will set the content field of events to an empty string, which is invalid. This will break sync and likely other things, as we saw here.

Please do not use this script because it's outdate rightnow. I created this script two year ago and till to now, I don't have time to maintain it along with the upgrade of system. So if you would like to use please get ideal from that script and make your own script to adapt your current system.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants