fromthepage icon indicating copy to clipboard operation
fromthepage copied to clipboard

Export downloads cleaned before they ought to be

Open saracarl opened this issue 6 months ago • 2 comments

EM at CA State Lib is getting a 500 error trying to download an export she did 4 days ago on the 1st.

Looking at the download record the processing log has been cleaned, which implies that the export zip file has also been cleaned.

The rake file for cleaning up exports is passed an argument of 7 days when the task runs in the crontab. I double checked the logic, and that's what this code does.

The cron job that calls the rake task 00 5 * * * /bin/bash -l -c 'cd /home/fromthepage/deployment/current && RAILS_ENV=production bundle exec rake fromthepage:clean_bulk_exports[7] >> /tmp/cron_log_file7 2>&1'

The code that "unlinks" (not actually deleting??) the export file: https://github.com/benwbrum/fromthepage/blob/development/app/models/bulk_export.rb#L124

Looking at the /tmp directory, there are no downloads there:

fromthepage@fromthepage:/tmp/fromthepage_exports$ pwd /tmp/fromthepage_exports fromthepage@fromthepage:/tmp/fromthepage_exports$ ls fromthepage@fromthepage:/tmp/fromthepage_exports$

Which is really weird because an export that ran today is downloadable and says it's in that (empty) directory. (So I"m thinking the empty /tmp directory is a red herring.)

It looks like exports run on August 2nd are also cleaned. Exports run on August 3rd are not.

So why is the exports being if they are older than 3 days, rather than 7?

saracarl avatar Aug 05 '24 18:08 saracarl