whiteboard
whiteboard copied to clipboard
backend: add the ability to auto-delete whiteboards
With the new possibilities offered by https://github.com/cracker0dks/whiteboard/pull/52, I'd like to add an option to auto delete all the data associated with a whiteboard after some amount of time after the last user connected to it / something was drawn.
It will ease handling of this app in a "production" setting.
It would be a very nice feature. I just wrote a docker image to restart the service each hour or day in order to delete old boards but a built-in system will be better
with master (not with version 1.6) you could build a command similar to
find . -type f ./savedBoards -mtime +15 -exec rm -f {} \;
to delete savedboards that have not beend touched for a while - or with slight adjustments, that have been created a while ago. Scheduling this via cron would already achieve that feature without docker restart.
it does get a bit more involved (although not really complicated) when you also want to remove uploads, as you should only delete those that are not referenced by existing whiteboards. This should be entirely possible with a small shell script or python parsing the whiteboard json, extracting the list of referenced images/documents and matching that against the uploads directory.