Modest contribution for OssnComments component

melo lobo Posted in Component Development 11 months ago

Hello, Michael Zülsdorff and Arsalan Shah,

While exploring the code a bit, I would like to offer a modest contribution to improve a specific aspect of the platform.

While trying to understand the image in a comment feature, I noticed a behavior that could be optimized. Currently, when a user selects an image for a comment but does not validate it (or changes the image before validation), the temporary files remain stored in the tmp folder. These files are only deleted if the user validates their comment with the image, which can lead to unnecessary accumulation of temporary files and affect server memory over the long term.

I think it would be beneficial to implement a mechanism to automatically clean up these unvalidated temporary files when the user cancels the action. This would help optimize resource usage and improve the overall experience.

I hope this observation can be useful to the project.

Replies
Indonesian Arsalan Shah Replied 11 months ago

Simply write a task on your system / cron job that delete files in temp older than 2 days

find /path/to/ossn_data/tmp/photos/ -mindepth 1 -mtime +2 -delete

You can adjust the command based on your OS type.