ep1cman / unifi-protect-backup

Python tool to backup unifi event clips in realtime
MIT License
577 stars 25 forks source link

Running as a docker container not cleaning up old files #72

Closed ep1cman closed 1 year ago

ep1cman commented 1 year ago

Discussed in https://github.com/ep1cman/unifi-protect-backup/discussions/71

Originally posted by **dkarzon** January 11, 2023 I am running this as a docker container on an unraid instance syncing from a UDM Pro to OneDrive. The sync up to OneDrive works great. However, I have noticed it doesn't seem to clean up the old files (those that fall outside of the retention period) when the container is left constantly running. As soon as I restart the container it then cleans up the old files as of the current time but continues to run only uploading. Is this a known issue with the docker container method of running it or is there something I am missing to have the clean up functionality on an always on docker container?
ep1cman commented 1 year ago

How old are we talking for those older files? In the latest update I turned down the purge frequency because on certain storage providers that charge per API call, it was incurring unacceptable costs.

Currently the application will check when it starts then once every 24h for files to delete. Is this not happening correctly for you? You can also adjust the purge interval using the PURGE_INTERVAL envrioment variable for the container

dkarzon commented 1 year ago

I don't think I was seeing it check every 24hours. I will monitor it again over the next few days without a restart to make sure and report back with what I am seeing. It may be happening every 24hours but just feels like it's not, I only noticed it because every time I restart the container I get an email from OneDrive saying lots of files were deleted.

Is there a specific time the purge happens or is it just 24 hours from when it started up? I can see files are being deleted from OneDrive every day as well, either way I will report back after doing some more testing.

dkarzon commented 1 year ago

I have done some further testing on this and it is working now. It's been running continuously for 12 days now and has been cleaning up correctly, not sure why it was a few days behind before. This can be closed now 👍